Sponsored Content
Full Discussion: Problem With Pointers
Top Forums Programming Problem With Pointers Post 302452790 by JohnGraham on Monday 13th of September 2010 04:45:48 AM
Old 09-13-2010
Quote:
Originally Posted by majid.merkava
Hi guys.

What is the difference between these:
1. int *a[100];
2. int (*a)[100];
The square array brackets (the '[' and ']') bind more tightly than the pointer operator, so the first declaration is equivalent to "int *(a[100])". Remember to read outwards from the identifier, so in the first declaration, a ("a") is an array ("a[]") of 100 ("a[100]") pointers ("*a[100]") to ints (int *a[100]").

In the second declaration, a is a pointer ("*a") to an array ("(*a)[]") of 100 ("(*a)[100]") ints.
These 2 Users Gave Thanks to JohnGraham For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

Pointers to Arrays

Below is the program i tried to execute...... main() { static int a = {0,1,2,3,4}; static int *p = {a, a+1, a+2, a+3, a+4}; printf (“\n %u %u %d”, p, *p, *(*p) ); } This works, but i wanted to know why both a and *p are declared as "static". If we dont declare a as static... (2 Replies)
Discussion started by: Jayathirtha
2 Replies

2. Programming

Regarding Function and Pointers.

HI, Here is some thing that is puzzling me from a long time. Can some body explain me this with example. The question is :- What is the difference between function pointer and pointer to a function. Where do we actually use the function pointers and pointer to functions. Thanks in... (0 Replies)
Discussion started by: S.Vishwanath
0 Replies

3. Shell Programming and Scripting

functiom pointers

Hi all i wonder about function pointers as i never used them in my C code . could any tell me why and where exactly function pointers come into picture . thanq (1 Reply)
Discussion started by: Raom
1 Replies

4. Programming

pointers

is this a valid c declaration int (*ptr(int *b)); plz explain... (4 Replies)
Discussion started by: areef4u
4 Replies

5. Programming

pointers

Hi I mash with pointers in C. I solve this problem about 5 hours and I don't know how I should continue. void InsertFirst (tList *L, int val) { tElemPtr new; if((new = malloc(sizeof(tElemPtr))) == NULL) Error(); new->data = val; new->ptr = L->frst; L->frst = new;... (2 Replies)
Discussion started by: Milla
2 Replies

6. Programming

Problem with pointers, structures, and Pthread

Hello all, I'm working on a small wrapper library for a bigger project, and i've been killing my self over (what I think is) a pointer problem. Here is the code (I extracted the part of the code where the problem is for better reading, I tested the code below, and I get the same problem):... (13 Replies)
Discussion started by: tmp0
13 Replies

7. Programming

Need help with the Pointers in C

I have a special character called ô. When it is declared as a character variable its showing it can be printed. But when it is declared as a character pointer variable its showing it cannot be printed. I am just wondering why its happening like this.. c1 = '@'; c2 = 'ô'; char *fp; fp="XXô"; if... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies

8. Programming

Problem with array of pointers

Hi All, I am using the array of pointers and storing the address of string.This is a global list. So i am using extern to give the reference of this list to another file and using reading the data from this string. But list is being corrupted and string is missing some characters in... (2 Replies)
Discussion started by: lovevijay03
2 Replies

9. Programming

Passing Pointers by reference in C++ Problem

Hello All, I am having this issue...where I am actually having hard time understanding the problem: The code is as follows: #include<iostream.h> void fxn(char*** var) { int i =4; *var = (char**)malloc(i*sizeof(char*)); for(int j =0; j<4; j++) { *var = "name"; cout<<*var;... (6 Replies)
Discussion started by: mind@work
6 Replies

10. Programming

Pointer to pointers

Hi guys, I'm trying to understand pointers in C and made a simple example and I've problems with It. Can someone help? #include <stdio.h> #include <stdlib.h> #include <assert.h> int f1(char **str_); int main(int argc, char **argv) { char *str = NULL; f1(&str); ... (3 Replies)
Discussion started by: pharaoh
3 Replies
YAGI(5) 							File Formats Manual							   YAGI(5)

NAME
yagi - yagi binary output format DESCRIPTION
This manual page describes the output format of the file created by the Yagi-Uda project's yagi program. The file is a binary file with a header of 100 bytes. The header consists of: offset(bytes) information data-type 0 elements int 4 driven int 8 parasitic int 12 min_frequency double 20 max_frequency double 28 design frequency double 36 step_frequency double 44 angular_step double 52 0 double 92 0 double Following the header, there starts the coordinates(x,y,l) of each element and the voltage applied to each element. Then we write the element currents one after the other, at each frequency. Hence the element currents will be written 12,000 times with a 3 element yagi analysed at 4,000 different frequencies. All complex data is stored in a structure of type fcomplex, defined as: struct fcomplex {double real, double imaginary}; offset(bytes) information data-type 100 x1 double /* coordinates */ 108 y1 double 116 l1 double 100+(n-1)*24 x_n double 100+(n-1)*24+8 y_n double 100+(n-1)*24+16 l_n double -------------- Repeated for each element. 100+24*elements Voltage1 fcomplex /* voltage */ 100+24*elements+(n-1)*16 Voltage_n fcomplex -------------- Repeated for each element n at each frequency step f. 100+40*elements Current1@f1 fcomplex /* current */ 100+40*elements+(n-1)*16 Current_n@f1 fcomplex 100+56*elements Current@f2 fcomplex 100+40*elements+(n-1)*16 Current_n@f2 fcomplex FILES
filename.out binary file SEE ALSO
yagi(1), output(1), input(1), optimise(1), first(1) and input(5). AUTHORS
Dr. David Kirkby G8WRB (david.kirkby@onetel.net), with help with converting to DOS from Dr. Joe Mack NA3T (mack@fcrfv2.ncifcrf.gov). Yagi version 1.16 24th October 2000 YAGI(5)
All times are GMT -4. The time now is 03:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy