I am struggling with the pointer to 2D-array (cf: 2D array of pointers). Can anybody help me elaborate how the pointerxmoves in the memory to access the individual of y[2][6], especially the high lighted lines?
I have talked to one of the curators of the forum, but I am still not quite clear.
Here is my code:
1) Although y and &y are the same, but x = y issues warning;
2) Q1a/Q2a is the part I think I understand which is the first element of each row of y.
3) but Q1b/c, and Q2b/c turns out to be 3-D to me.
Can anybody give me a diagram how pointer x moves in the memory for each member of y?
4) Line 9: int (*a[8])[5]; is related, and I put it here for future reference but skip it at this moment.
void main()
{
int a={1,2,3,4,5,6,7,8,9,10};
int *p=a;
int *q=&a;
cout<<q-p+1<<endl;
}
The output is 10, how?
if we give cout<<q it will print the address, value won't print....
if we give cout<<p it will print the address, value won't print....
p has the base addr; q... (1 Reply)
All ..
I am having a pointer array . And trying to store the addess into that pointer array . please see below the problem i faced
code:
int cnt1;
char *t_array;
char *f_array;
for(cnt1=0; cnt1<1000; cnt1++)
{
t_array =... (1 Reply)
If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it:
(1) one is to pass a pointer-to-pointer parameter, like:
int my_malloc(int size, char **pmem)
{
*pmem=(char *)malloc(size);
if(*pmem==NULL)... (11 Replies)
Hi all,
Can anyone provide help with getting the right syntax regarding array/pointers in C in the following code? Can't locate a specific example which clarifies this...
Say I declare a typedef to an array of pointers to some type...
/**
* An array of ptrs to sections
*/
typedef... (4 Replies)
if i create an array of pointers to a structure "struct node" as:
struct node *r;
and create "n" number of "linked lists" and assign it to the various struct pointers r using some function with a return type as structure pointer as:
r=multiplty(.......) /*some parameters*/
is... (2 Replies)
This code is to print out the program name and arguments list one by one:
1 #include<stdio.h>
2
3 void main(int argc, char *argv)
4 {
5 int iCount = 0;
6 while (iCount < argc) {
7 printf("argc:%d\t%s\n",iCount, argv);
8 ... (14 Replies)
Hello,
The purpose of the program is to print a sub string from the prompt inputs. I do not understand why char pointer does not work but char array will for line 40 and Line 41.
./a.out thisisatest 0 8
substring = "thisisat"And my code is:
#include <stdio.h>
#include <stdlib.h>
#include... (29 Replies)
how to copy content of character pointer to character array in c programming..
char *num;
char name=num; (1 Reply)
Discussion started by: zinat
1 Replies
LEARN ABOUT CENTOS
auparse_init
AUPARSE_INIT(3) Linux Audit API AUPARSE_INIT(3)NAME
auparse_init - initialize an instance of the audit parsing library
SYNOPSIS
#include <auparse.h>
auparse_state_t *auparse_init(ausource_t source, const void *b);
DESCRIPTION
auparse_init initializes an instance of the audit parsing library. The function returns an opaque pointer to the parser's internal state.
It is used in subsequent calls to the library so. The source variable determines where the library looks for data. Legal values can be:
AUSOURCE_LOGS - use audit logs
AUSOURCE_FILE - use a file
AUSOURCE_FILE_ARRAY - use several files
AUSOURCE_BUFFER - use a buffer
AUSOURCE_BUFFER_ARRAY - use an array of buffers
AUSOURCE_DESCRIPTOR - use a particular descriptor
AUSOURCE_FILE_POINTER - use a stdio FILE pointer
AUSOURCE_FEED - feed data to parser with auparse_feed()
The pointer 'b' is used to set the file name, array of filenames, the buffer address, or an array of pointers to buffers, or the descriptor
number based on what source is given. When the data source is an array of files or buffers, you would create an array of pointers with the
last one being a NULL pointer. Buffers should be NUL terminated.
RETURN VALUE
Returns a NULL pointer if an error occurs; otherwise, the return value is an aopaque pointer to the parser's internal state.
SEE ALSO auparse_reset(3), auparse_destroy(3). auparse_feed(3).
AUTHOR
Steve Grubb
Red Hat Feb 2007 AUPARSE_INIT(3)