mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-03-14 17:00:05 +01:00
[SPCA] Fix various errors
This commit is contained in:
@@ -29,11 +29,11 @@ int get_user_input_int( char prompt[] ) {
|
||||
printf( "Hello World\n" );
|
||||
}
|
||||
|
||||
// Inversed while loop (executes at least once)
|
||||
// Inverted while loop (executes at least once)
|
||||
do {
|
||||
input_data -= 1;
|
||||
input_data_copy -= 1;
|
||||
printf( "Bye World\n" );
|
||||
if ( input_data_copy == 0 )
|
||||
if ( input_data_copy == 10 )
|
||||
goto this_is_a_label;
|
||||
} while ( input_data_copy > 1 );
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ int main( int argc, char *argv[] ) {
|
||||
assert( arr == &( arr[ 0 ] ) ); // Evaluates to true
|
||||
int new_arr[ 3 ] = arr; // Compile time error (cannot use other array as initializer)
|
||||
int *new_arr_p = &arr[ 0 ]; // This works
|
||||
void *t;
|
||||
|
||||
a_function( &get_user_input_int, c_arr );
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
int a[ 2 ];
|
||||
int *b = malloc( 2 * sizeof( int ) ), *c;
|
||||
int *b = (int *) malloc( 2 * sizeof( int ) ), *c;
|
||||
a[ 2 ] = 5; // assign past the end of an array
|
||||
b[ 0 ] += 2; // assume malloc zeroes out memory
|
||||
c = b + 3; // mess up your pointer arithmetic
|
||||
|
||||
Reference in New Issue
Block a user