

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


What code is needed to use printf? - ANSWER...-#include Which function does the first code reside? - ANSWER...-main What type is the main function? - ANSWER...-int What does the main function return when it is executed successfully? - ANSWER...- 0 What does every line end with? - ANSWER...-semicolon What basic function is used to print something to the screen? - ANSWER...-printf What is the range of integer char? - ANSWER...--128 to 127 What is the range of integer long? - ANSWER...--2,147,483,648 to 2,147,483, How do we define a 'int' variable named 'foo' with value '1'? - ANSWER...-int foo = 1; How do we define an array named 'foo'? - ANSWER...-int foo[]; How do we define a string named 'foo' with value 'bar' using pointers? - ANSWER...- char * foo = "bar"; How do we define a string named 'foo' with value 'bar' using arrays? - ANSWER...-char foo[] = "bar"; char foo[] = "bar", What is the length of foo? - ANSWER...- 4 What is the function to compare two strings? - ANSWER...-strncmp int i; for ( **) { printf("%d", i); } What should be the ** to print "0123456789"? - ANSWER...-i=0;i<10;i++ What is the command to exit from a loop? - ANSWER...-break What is the command to skip over a loop? - ANSWER...-continue How do we define an integer pointer named 'foo'? - ANSWER...-int * foo; int * foo; int bar = 1; How do we make 'foo' to point to the address of 'bar'? - ANSWER...-foo = &bar;
How do we get the memory address of a variable named 'foo'? - ANSWER...-&foo How do we dereference a pointer named 'foo'? - ANSWER...-foo int a = 1; int * pointer_to_a = &a; What is the value of 'pointer_to_a'? - ANSWER...- 1 How do we define a structure named 'foo' with a variable 'int bar;'? - ANSWER...-struct foo { int bar; } How do we define a 'foo' typedef structure with variable 'int bar'? - ANSWER...-typedef struct { int x; } foo; struct point { int x; int y; } How do we declare a 'point' structure named 'p'? - ANSWER...-struct point p; struct point { int x; int y; } struct point p; How do we set the value of x of p to 1? - ANSWER...-p.x = 1; typedef struct { int x; int y; } point; How do we declare a new 'point' named 'p'? - ANSWER...-point p; int foo = 1; void bar(**) { *baz++}; What should be in the ** to increase the value of foo by 1 using the function 'bar'? - ANSWER...-int * baz void addOne(int * n) { *n++; }; int n = 1; How do we increase the value of n using the function? - ANSWER...-addOne(&n); typedef struct { int x; } point; point p; p.x = 1; void addOne(point * p) { **} What do we add in the function to increase the value of p.x by 1? - ANSWER...-p->x++ typedef struct { char * name; int age; } person; person * myperson; How do we allocate a new person struct where myperson is pointing? - ANSWER...-myperson = malloc(sizeof(person)); What function do we use to release a dynamically allocated pointer? - ANSWER...- free(); int foo = 1; void bar(int * baz) { *}; What should be in the ** to increase the value of foo by 1 using the function 'bar'? - ANSWER...-baz++;