Are we having any fun, yet?
it will display the string
Are we hving ny fun, yet?
You may use either array subscript notation or pointer notation to solve this problem.
#include <stdio.h> void passPointers(int *p1, int *p2); int main() { int array[10] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; int *pBeg, *pEnd; int i; pBeg = array; pEnd = &array[9]; passPointers (pBeg, pEnd); for (i=0; i<10; i++) printf("%d ", array[i]); return 0; } void passPointers (int *p1, int *p2) { int i; for (i=0; i<3; i++) p1++; for (i=0; i<3; i++) p2--; while (p1 != p2){ *p1 = *p1 + 5; p1++; } return; }
Questions 4 - 6 are worth 5 points each:
float x; float *z=&x;which scanf statement would successfully read a float value into x?
scanf ("%f", x);
scanf ("%f", z);
scanf ("%f", *z);
stdout
.
# makefile for exam 2 projectAlpha: main.o tree.o list.o gcc main.o tree.o list.o -o projectAlpha main.o: main.c tree.h list.h gcc -c -Wall main.c tree.o: tree.c tree.h gcc -c -Wall tree.c list.o: list.c list.h gcc -c -Wall list.c # end of makefile
struct date{ int month; int day; int year; }; struct birthrecord{ char lastname[25]; /* a null-terminated string */ char firstname[25]; /* a null-terminated string */ struct date dob; /* date of birth */ float length; int pounds; int ounces; }; struct birthrecord babies[500];