printf("\nlVptr[60 ] is %d \n", *(int*)lVptr);
This will cast the void pointer to a pointer to an int
and then dereference it correctly.
If you want to treat it as an array (of one), you could do a slightly ugly ((int *)lVptr)[0]
. Using [1]
is out of bounds, and therefore not a good idea (as for lVptr[60]
…)
Related Posts:
- Pointer Arithmetic
- char *array and char array[]
- C pointers and arrays: [Warning] assignment makes pointer from integer without a cast
- Difference between char* and const char*?
- #31 expression must have integral type
- How do you pass a function as a parameter in C?
- Invalid pointer error on invoking free() after malloc in C
- expression must have integral type
- What’s wrong with my code? What is argv[1]?
- Valgrind: Invalid read of size 1
- Constant pointer vs Pointer to constant
- Reversing a string in C
- Warning: return from incompatible pointer type in C
- strcmp giving segmentation fault
- Why am I getting this error: “data definition has no type or storage class”?
- warning: passing argument ’from incompatible pointer type [enabled by default]’
- char pointers: invalid conversion from ‘char*’ to ‘char’?
- What is the difference between char array and char pointer in C?
- typedef struct pointer definition
- The difference between char * and char[] [duplicate]
- lvalue required as increment operand
- Implementing Taylor Series for sine and cosine in C
- warning: implicit declaration of function
- pthread_join() and pthread_exit()
- Why should we typedef a struct so often in C?
- What is the difference between ++i and i++?
- Undefined reference to pthread_create in Linux
- Stack smashing detected
- Why am I getting “void value not ignored as it ought to be”?
- Openssl : error “self signed certificate in certificate chain”
- How do I create an array of strings in C?
- How do function pointers in C work?
- “Expected expression before ‘ { ‘ token”
- How to generate a random int in C?
- How do I use valgrind to find memory leaks?
- How to print the array?
- How to solve the error: assignment to expression with array type
- segmentation fault : 11
- What does “1e” mean?
- how to use uint64_t in C [duplicate]
- munmap_chunk(): invalid pointer
- How do I solve the following errors: “Undefined reference to WinMain”, “[Error] Id returned 1 exit status”?
- Warning comparison between pointer and integer
- What is the LD_PRELOAD trick?
- How do I properly compare strings in C?
- Connect: Socket operation on non-socket
- How to correctly use the extern keyword in C
- How do we check if a pointer is NULL pointer?
- how to use wait in C
- How do I calculate MB/s & MiB/s?
- In C programming, what is `undefined reference`error, when compiling?
- Passing by reference in C
- double free or corruption (fasttop)
- Returning string from C function
- error: expected declaration or statement at end of input in c
- Why does the arrow (->) operator in C exist?
- Why do I get clang: error: linker command failed with exit code 1?
- How to convert integer to char in C?
- Program received signal SIGPIPE, Broken pipe
- How to read from stdin with fgets()?
- Why am I getting “array initializer must be an initializer list or string literal”?
- Reading a string with scanf
- getopt_long() — proper way to use it?
- C read file line by line
- C read file line by line
- Copying a part of a string (substring) in C
- Incompatible implicit declaration of built-in function ‘malloc’
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- expression must have integral type
- Does C have a “foreach” loop construct?
- What is a bus error? Is it different from a segmentation fault?
- What is the cause of flexible array member not at end of struct error?
- How to remove the character at a given index from a string in C?
- How can I get argv[] as int?
- waitpid, wnohang, wuntraced. How do I use these
- Why I do get “Cannot find bound of current function” when I overwrite the ret address of a vulnerable program?
- Warning: assignment from incompatible pointer type
- valgrind – Address —- is 0 bytes after a block of size 8 alloc’d
- How to printf a memory address in C
- What is the use of intptr_t?
- Writing binary number system in C code
- How does one represent the empty char?
- Removing trailing newline character from fgets() input
- “Multiple definition”, “first defined here” errors
- What does ** mean in C?
- Get size of pointer in C
- how use EOF stdin in C
- Execution of printf() and Segmentation Fault
- How does the strtok function in C work? [duplicate]
- switch case: error: case label does not reduce to an integer constant
- warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
- warning: return makes pointer from integer without a cast but returns integer as desired
- Reaching EOF with fgets
- Difference between char* and char** (in C)
- How to clear input buffer in C?
- What primitive data type is time_t? [duplicate]
- Using pointer to char array, values in that array can be accessed?
- Usage of \b and \r in C
- Parsing command-line arguments in C
- Compiler warning – suggest parentheses around assignment used as truth value