Question

I am really confused with pointers in C. What is the difference between : char* p;...

I am really confused with pointers in C. What is the difference between :
char* p; vs char *p;

Homework Answers

Answer #1

Both char* p and char *p are same. It denotes that p is a pointer to character. Space is not significant in pointer declaration.

We can also write the same thing as char * p which has a space between p & * and also char & *.

If you declare as below

            char* a,b;

here 'a' is the pointer to character and 'b' is simply a character.

ie the above code is equivalent to

       char *a;

      char b;

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
difference between treasury bonds and government bonds? are they the same? I'm really confused
difference between treasury bonds and government bonds? are they the same? I'm really confused
Hello! I am a bit confused about this question,, I was under the impression that a...
Hello! I am a bit confused about this question,, I was under the impression that a residual in statistics is the difference between the observed and predicted values of the dependent variable Y for a given value of X. Here is the question along with my choices... A residual is: The difference between a data point and the regression line. A value that can be 1 or zero. A value that is always negative because it is a difference The...
1) Explain the difference between: Array of characters like char c[] = {'A', 'B', 'C'}; AND...
1) Explain the difference between: Array of characters like char c[] = {'A', 'B', 'C'}; AND c-string like string = "ABC"; 2) We can have two pointers that point to one memory location such as: int *intPtr1, *intPtr2; intPtr1 = &x; intPtr2 = &x; a) What method we have to make sure only one pointer points to a variable? b) Give an example. 3) a) Can a pointer to a constant receive an address of a constant item and/or non-constant...
2. What are the stages to end of life? List at least 3. I am really...
2. What are the stages to end of life? List at least 3. I am really confused if this question means preperation for this stage of life or stages of death. It is not covered in our boom or slides but is being asked of us in discuscion.
In this question, I am confused about the difference between correlation and concordance. Can somebody explain...
In this question, I am confused about the difference between correlation and concordance. Can somebody explain this to me? Consider the following scenario, and briefly describe what the correlations say about the relative genetic and environmental influences for the trait in question. You decide to conduct a follow-up study on tattoo and piercing behavior using a slightly different experimental design. This time, you collect data on the number of tattoos and piercings between monozygotic twins who were either raised apart...
I am trying to reduce the number of terms, but I am confused on how to...
I am trying to reduce the number of terms, but I am confused on how to get three terms because of I and M. Can you combine terms with similar meanings? R= regret losing M= motivated I= inspired players C= coachable All non-R are non-M No I are non-C No C are R
Hi I am working on set proofs and I am a little confused. The proposition is:...
Hi I am working on set proofs and I am a little confused. The proposition is: Given sets A and B, B-(B-A)=A iff A is a subset of B.
What is the difference between the following two declarations? char array[] = “Hello World”; char *array...
What is the difference between the following two declarations? char array[] = “Hello World”; char *array = “Hello World”;
NO POINTERS TO BE USED. This is C programming. I am trying to make a function...
NO POINTERS TO BE USED. This is C programming. I am trying to make a function to calculate standard deviation from a hard coded array. Why is my function not returning my stddev value back to main? I keep getting an error saying that stddev is undeclared. #include <stdio.h> #include <math.h> float calcstddev(float examgrades[], int size) {    float sum =0.0;    float mean;    int temp;    float variance;    float stddev;    float difference;    for (temp=0;temp<size;++temp)   ...
I am running this code using C to count the words in char array, but somehow...
I am running this code using C to count the words in char array, but somehow it keeps counting the total characters + 1. Any solution to fix this problem? #include <stdio.h> int main() {    char input[1001];    int count =0;    fgets(input, 1001, stdin);    char *array = input;    while(*array != '\0')       {        if(*array == ' '){            array++;        }        else{        count++;        array++;...