C Beginner Looking For Suggestions


 
Thread Tools Search this Thread
Top Forums Programming C Beginner Looking For Suggestions
# 8  
Old 03-31-2009
Quote:
Originally Posted by deckard
When I've seen him do PHP queries against a MySQL DB, he doesn't just do a single query. He'll usually pull in multiple bits of information even though to me it doesn't seem relevant. But afterwards in his PHP script, the data returned from the queries is used in groups. Kind of hard to explain I guess. It's just that my thinking would be:

Execute a query and pull in one column of data
Process the data
Execute another query for another column
Process that data
etc...
Then take all the data stored in arrays and format it for display

Whereas his thinking seems to be

Execute a query to pull in all needed data from multiple tables
Process in one function and format for display

I guess maybe it just takes having a lot of familiarity with the language and you start to see the quicker way of doing things. His approaches also seem to be able to avoid the spaghetti logic I get myself into sometimes by nature of their compactness.
who is "he"?
if you described it to me, that means you too are thinking in that way...for describing it to me...SmilieSmilie
dont push yourself too hard...

no its not the language really, its the familiarity with the concept that you apply...the technical details can always be found in the documentation, concepts cannot.
# 9  
Old 04-01-2009
Wow! Thank you everyone! As always unix.com comes through with some good insight. It's quite encouraging and inspiring. So I will press onward. I especially appreciated the suggestion that understanding the concepts if more important than understanding the language. That's been my approach to learning GNU/Linux to the point where I can use most distros fairly easily. I just need to do that with programming and maybe the jump from Bash to C will be mirrored in C to C++, PHP, Perl, Javascript and Java. (It might sound ambitious but I really want to get there) Now back to K&R C (this is the second edition which covers C89 ANSI C).
# 10  
Old 04-01-2009
I got a nice simple response from a friend on another forum. (I can't be sure he didn't cheat and just post the answer from the K&R answer book, but I'll give him the benefit of the doubt)

Code:
int main()
{
    c = getchar();
    while (c != EOF)
    {
        putchar(c);
        do
        {
            c = getchar();
        } while ( c != EOF && c == ' ');
    }
    return 0;
}

Although I'm not yet used to the do-while construct, I can see where it works very nicely here. It checks the condition after executing the statements inside the loop. I think this is somewhat like Bash's do-until structure (although I've never used that). Just thought I'd share. Now onto the other problems in the chapter.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Suggestions on this script please

i=1 out="" j=`expr 2 * $1` while do out="$out"#"" echo $out ((i=i+1)) done while do print ${out%?} ((i=i+1)) done This script is throwing an error: gurnish:/home/fnb/gurnish/saurabh/scripts> while1 3 expr: 0402-050 Syntax error. # (6 Replies)
Discussion started by: targetshell
6 Replies

2. UNIX for Dummies Questions & Answers

Suggestions for the interview

Hi guys, i'm undergoing a traning in solaris administration and i request if any one have an idea on the interview questions on solaris. thank you. (3 Replies)
Discussion started by: 038karthik
3 Replies

3. Solaris

Suggestions for new T5140

I've been busy and fell behind on Sun/Oracle. Forgive me if too basic. I welcome brief, cryptic, or advanced replies. I also welcome noobie information since I may have no clue what's up at the moment. Problem statement: I inherited a computer to set up. I would rather not figure out 8 months... (1 Reply)
Discussion started by: Nevyn
1 Replies

4. UNIX for Advanced & Expert Users

Need suggestions.......

Hello there....i am a final year comp science student.......i am thinking of doing my project on unix platform......which one do u suggest?thanx in advance... (3 Replies)
Discussion started by: theprasad1990
3 Replies

5. Shell Programming and Scripting

Suggestions on input

Hi, I have written a script which calls a process which ends up in a reboot of the system. At the end of the reboot it prompts for login & i need to provide the login details. am not able to figure out hw to do this. Doubt: will echoing login details after calling the process work? for ex:... (1 Reply)
Discussion started by: meera
1 Replies

6. Solaris

Suggestions Req

Hi all, I have worked on HP UNIX and now i have moved to SunSolaris which i never used to work. I am more on programming side like shell and perl scripting. So i want to know from you experts that i need to take care or changes which i code in sun solaris in compared to HP unix. Suggestions... (1 Reply)
Discussion started by: ravi.sadani19
1 Replies

7. UNIX for Advanced & Expert Users

Looking for Suggestions...

We run WebSphere and by default it wants to install everything under /usr. While I can understand the default (everyone has a /usr) I would like to move this over to a dedicated volume group called apps and then setup my lv's and fs's here. Our WebSphere Admin doesn't like this because apparently... (1 Reply)
Discussion started by: scottsl
1 Replies

8. UNIX for Dummies Questions & Answers

Backup suggestions

The current backup procedure we using a tar command in linux. The files are stored in one partition in different folders. The docs stores in day wise folders like ex: /usr/data/xyz/20050129, /usr/data/xyz/20050130 .............etc We using tar & gzip command to take backup everyday. The backup... (3 Replies)
Discussion started by: bache_gowda
3 Replies

9. UNIX for Dummies Questions & Answers

Suggestions wanted ...

All, Have an AMD-K6/2 PC, 20G.Hd along with RH7.2. Wanting to know what I should do in terms of setup (workstation/server) and then what I can do with it? I'd like to learn a DBMS and SQL - can I do this using RedHat? Any suggestions with how I can use/ what I can do with this appreciated. (3 Replies)
Discussion started by: Cameron
3 Replies

10. UNIX for Dummies Questions & Answers

Suggestions on where to begin?

I have been a student at Hendrix Institute for about a year now. My term is comming to an end by the end of december. I have learned varios computer programs for web development that include Flash 5 and Dreamweaver. Actionscripting, Javascript and Database development with Access was all... (4 Replies)
Discussion started by: andrew25008
4 Replies
Login or Register to Ask a Question