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