ME 218 LAB 4 - Greg Gangluff Lab 4 T 1-3 4.1 #include...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Greg Gangluff Lab 4 T 1-3 4.1 #include <stdio.h> void main() { int ac; int * acPTR; ac = 936; acPTR = &ac; printf("My parents area coode is %d\n", ac); printf("My parents area code is %d\n", *acPTR); printf("the address of ac in memoery is %d \n", &acPTR); } 4.2 #include <stdio.h> void main() { int lol[9]; int i=0; lol[0] = 30; while ( i < 9) { lol[i +1] = lol[i] - 2 ; printf(" %d \n", lol[i]); i++; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} 4.3 #include <stdio.h> #include <string.h> void main() { char text1[100]; int i; int a; int b; int c; char message[] = "Hello, I am a string; what are you?"; /*compiler figures length automatically */ printf("Original message: %s\n", message); /* copy the message to text1 the hard way */ i=0; while ( (text1[i] = message[i]) != '\0' ) i++; printf("text1: %s\n", text1); /* text1 needs to be long enough to hold all the chars! */ a = strcmp(text1,message); printf(" comparison is %d\n", a);
Background image of page 2
b = strlen(text1); printf("length of text1: %d\n", b); c = strlen(message); printf(" length of message: %d\n",c);
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/23/2011 for the course ME 218 taught by Professor Unknown during the Fall '08 term at University of Texas at Austin.

Page1 / 6

ME 218 LAB 4 - Greg Gangluff Lab 4 T 1-3 4.1 #include...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online