Click here to Skip to main content
15,887,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C
#include<stdio.h>
void RevArr(int arr[], int size);
void Rev(int arr[], int size);
int main(){
    int size;
    printf("Enter the size of array :");
    scanf("%d", &size);
    int arr[size];
    for(int i=0;i<size;i++){
        printf("Enter element \n");
        scanf_s("%d", &arr[i]);
    }
    PrintRev(arr[size], size);
}
void RevArr(int arr[], int size){
  
    
}
void Rev(int arr[], int size){
  for(int i=0;i<size;i++){
    printf("%d ", arr[i]);
  }
}


What I have tried:

I really cant figure where am i wrong any help would be appreciated!!!
Posted
Updated 15-Apr-22 3:17am
v3

How about telling us what your uncommented code is trying to do, rather than letting us try to figure it out?

I'm not going to try and compile this, but RevArr does nothing and PrintRev isn't even declared anywhere and will therefore cause a compile error.
 
Share this answer
 
Comments
CPallini 15-Apr-22 9:44am    
5.
The following code fixes the syntax.
In order to fix the logic flaws (if any) you should tell us what your program is expected to do.
C
#include<stdio.h>

void RevArr(int arr[], int size);
void Rev(int arr[], int size);
int main()
{
    int size;
    printf("Enter the size of array :");
    scanf("%d", &size);
    int arr[size];
    for(int i=0;i<size;i++)
    {
        printf("Enter element \n");
        scanf_s("%d", &arr[i]);
    }
    Rev(arr, size);
    return 0;
}
void RevArr(int arr[], int size)
{
    // what shoudl this function do?  
}
void Rev(int arr[], int size)
{
    for(int i=0;i<size;i++)
    {
        printf("%d ", arr[i]);
    }
}
 
Share this answer
 
Comments
Ayush Apr2022 15-Apr-22 9:10am    
I figured it out eventually, I was passing an array as an parameter...
Anyways thanks for your time :)
Greg Utas 15-Apr-22 9:24am    
5, partly for being so kind. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900