15,503,315 members
See more:
```#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int n,i,j=0;
char** a = (char**)calloc(n,sizeof(char*));
printf("enter the level of pyramid: ");
scanf("%d",&n);
for(i=0;i<n;i++){
*(a+i)=(char*)calloc((2*n-1),sizeof(char));
while(j<(n-1-i)){
*(*(a+i)+j) = ' ';
j++;
}
while(j<(n-1-i+(2*i+1))){
*(*(a+i)+j)='*';
j++;
}
while(j<(2*n-1)){
*(*(a+i)+j) = ' ';
j++;
}
//printf("%s",*(a+i));
puts(*(a+i));
}
return 0;
}```

What I have tried:

Please refer description, I am unable to debug the code
Posted
Updated 5-Oct-21 23:29pm
v3
jeron1 5-Oct-21 17:56pm
and the error would be?
ABDEALI ATTARWALA 6-Oct-21 0:51am
the output for n=3 is displayed as follows
*
and for every n it is just printing one star and leaving spaces, if possible please run the code so that you can see the complete output
Thank you

## Solution 1

Quote:
I have written star pyramid pattern code using pointer to pointer in C but can't resolve the error

On first look, I would start by resetting the column number on every line.
C++
```for(i=0;i<n;i++){
*(a+i)=(char*)calloc((2*n-1),sizeof(char));
j=0;
while(j<(n-1-i)){
```

ABDEALI ATTARWALA 6-Oct-21 0:58am
Thank you sir, it really worked!

## Solution 2

Learn to use the debugger for debugging and understand the code. Start with some Debugger video tutorial.

When you dont like debugging than coding is pain in the ass ;-)