Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void display(int array[], int rows);
- void doubled(int array[], int rows);
- int main(void){
- int array1[3][5]={{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5}};
- display(array1, 3);
- printf("\n");
- doubled(array1, 3);
- display(array1, 3);
- printf("\n");
- }
- void display(int array[], int rows){
- int i,x;
- for(i=0; i<rows; i++){
- for(x=0; x<5; x++){
- printf("%4d", *(array+x));
- }
- printf("\n");
- }
- }
- void doubled(int array[], int rows){
- int i,x;
- int *ptr=array;
- for(i=0; i<rows; i++){
- for(x=0; x<5; x++){
- *ptr*=2;
- printf("after doubling: %d\n",*ptr);
- ptr++;
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement