Click here to Skip to main content
12,945,945 members (40,095 online)

array of char , array of integers and pointers to constant

steven8Gerrard asked:

Open original thread
I have two questions

Question Number 1
int *p;
int a[]={1};
char *q;
char b[]="welcome";

in part1.c it prints the address of variable where in part2.c it prints the values that is string? Only the return type is different how?

Question No 2

int a=10;
int const *p=&a;

Above program is pointer to constant . Here i have changed the value of a but it is not showing errors why? Does pointer to constant mean that variable should be declared as const (i.e)
const int a =10;
Tags: C++, C, C#


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Mobile
Web01 | 2.8.170518.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100