question 2:
#include<stdlib.h>
#include<stdio.h>
#include<assert.h>
void overflow(int n)
{
if(n == INT_MAX){
return;
}
printf("%d\n",n);
overflow(n+1);
}
void foo(int n)
{
int* arr = malloc(100*sizeof(int));
assert(arr);
for(int i=0; i<100; i++){
arr[i] = i+n;
}
printf("%d\n", arr[99]);
foo(n+1);
}
void bar(int n)
{
int arr[100];
for(int i=0; i<100;i++){
arr[i] = i+n;
}
printf("%d\n",arr[99]);
bar(n+1);
}
int main()
{
bar(1);
return 0;
}
b)
c)
using foo:
using bar:
No comments:
Post a Comment