Beschreibe hier die neue Seite. |
irc#c [[Code] Problem: 01:06 < alt_don> having problems getting the syntax down 01:07 < alt_don> it compiles fine with gcc -Wall 01:07 < alt_don> but does not work as I intend it to 01:10 < alt_don> I am new to C so I don't see my mistake ] [[Code] #include <stdio.h> char user_input[128]; int term1; int term2; int term4; int main(int argc, char *argv[]) { printf("please enter two values here: "); fgets(user_input, sizeof(user_input), stdin); sscanf(user_input, "%d %d", &term1, &term2); if (argc < 2) printf("you need to input at least two characters here\n"); else term4 = term1 + term2; printf("%d", term4); return (0); } ] don't correct it .. just think about it :-) this is a nice one [[Code] #include <stdio.h> #include <string.h> int main(){ char *string=0; printf("%d",strlen(string)); return(0); } ] strlen is not NULL pointer safe |
![]() |
|
![]() |
|
don't correct it .. just think about it :-) this is a nice one
![]() |
|
strlen is not NULL pointer safe