Hey Guys,
Just wondering....what is the value of the variables a and b after executing each line of the following code in C?
CheersCode:int a, b; int *pa, *pb; a= 2; b= 3; pa =&a; pb= pa: b++; *pb= *pa+1; a +=b;
Hey Guys,
Just wondering....what is the value of the variables a and b after executing each line of the following code in C?
CheersCode:int a, b; int *pa, *pb; a= 2; b= 3; pa =&a; pb= pa: b++; *pb= *pa+1; a +=b;
Write a program to find out.Originally Posted by Lego_TeCh
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Are you in an exam and using your iPhone or something? They should put a compiler in those
What do think the answer should be? Were you right, or wrong?
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Actually, the jailbroken ipod touches/iphones let you install gcc on themAre you in an exam and using your iPhone or something? They should put a compiler in those
Hey Guys,
Just compiled the code below, I`v debugged some of the errors....but i`m still receiving these errors;
value.c
value.c(5) : error C2449: found '{' at file scope (missing function header?)
value.c(16) : error C2059: syntax error : '}'
Which function header do I need to implement?Code:#include <stdio.h> int a, b; int *pa, *pb; { a= 2; b= 3; pa =&a; pb= pa; b++; *pb= *pa+1; a +=b; return 0; }
main() maybe ?
Code:#include <stdio.h> int a, b; int *pa, *pb; int main() { a= 2; b= 3; pa =&a; pb= pa; b++; *pb= *pa+1; a +=b; return 0; }
Spidey out!
You need a main() function...
Have you not written any program in this course until now? And you are already working with pointers?
Ah well, I suggest you start reading the book from chapter 1, then.
Yeah, that's how I figured s/he must have skipped (or skimmed through) quite a few chapters. Unfortunately for learning the basics of C, that won't work. For advanced topics maybe.