Programming
Workshop

Spring 2014
course
navigation

pointers

Discuss pointers in C.
... and anything else that folks are interested in.

can you find the bug?

# include <stdio.h> # include <stdlib.h> # include <math.h> int modarithmeticone(int i, int x){ int one=1, n; float negativeone = -1.0; x = i * (int) pow(negativeone, (double)(i + one)) % n; return x; } int main(){ int a=4, i, x, n=9; for (i = 1; i <= a; i++){ /*if (dividenumbminusone(n, 1, 2, a)!=0){*/ if (modarithmeticone(i, x)){ printf("x = %i n = %i a = %i i = %i \n", x,n,a,i); } } return 0; }
http://cs.marlboro.edu/ courses/ spring2014/workshop/ notes/ pointers
last modified Thursday April 10 2014 4:59 am EDT