Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <stdio.h>
- using namespace std;
- struct Car
- {
- int wheels;
- char color[99];
- };
- void foo(Car *p);
- ////////////////////////////////////////////////
- int main()
- {
- Car y, u;
- y.wheels = 4;
- u.wheels = 8;
- strcpy(u.color ,"red" );
- y.color[0] = 'Y';
- y.color[1] = 'e';
- y.color[2] = 'l';
- y.color[3] = 'l';
- y.color[4] = 'o';
- y.color[5] = 'w';
- y.color[6] = 0 ;
- foo(&u);
- }
- /////////////////////////////////////////////////
- void foo(Car *p)
- {
- printf("u.color = %s\n", p->color );
- printf("u.wheels = %d\n", p->wheels);
- }
- /*
- #include <string.h>
- #include <stdio.h>
- // 1
- // 2
- // 3
- ////////////////////////////////////////////////
- int main()
- {
- int b = 4 * 4;
- int *p = &b;
- int b2 = *p;
- printf("b2 = %d\n", b2);
- }
- */
- /*
- #include <iostream>
- #include <string.h>
- #include <stdio.h>
- using namespace std;
- struct Car
- {
- int wheels;
- char color[99];
- };
- ////////////////////////////////////////////////
- int main()
- {
- Car y, u;
- y.wheels = 4;
- u.wheels = 8;
- strcpy(u.color ,"red" );
- y.color[0] = 'Y';
- y.color[1] = 'e';
- y.color[2] = 'l';
- y.color[3] = 'l';
- y.color[4] = 'o';
- y.color[5] = 'w';
- y.color[6] = 0 ;
- printf("y.color = %s\n", y.color);
- }
- */
- // strcpy(y.color ,"Black");
- /*
- #include <iostream>
- #include <string.h>
- #include <stdio.h>
- using namespace std;
- struct Car
- {
- int wheels;
- char color[99];
- };
- ////////////////////////////////////////////////
- int main()
- {
- Car y, u;
- y.wheels = 4;
- strcpy(y.color ,"Black");
- strcpy(u.color ,"red" );
- y.color[0] = 'Y';
- y.color[1] = 'e';
- y.color[2] = 'l';
- y.color[3] = 'l';
- y.color[4] = 'o';
- y.color[5] = 'w';
- y.color[6] = 0 ;
- printf("y.color = %s\n", y.color);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement