Solved

Increments inside static char array[] ???

Posted on 2001-06-28
4
464 Views
Last Modified: 2008-03-06
How do i use the ++ and -- increments inside static char array[] variables?

Thanks in advance,

Alan
0
Comment
Question by:alanwhincup
  • 2
4 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6234996
What exactly are you trying to do?

Instead of trying to increment the array[] variable, you should have a second variable, and increment that.

Example:

int index=0
char array[32]="Axter";
do
{
printf(array[index]);
index++;
}while(index<5);
0
 
LVL 30

Expert Comment

by:Axter
ID: 6235010
Also it makes no difference wheather the variable is static or not.
0
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 6235191
Or do you mean:

static char c[] = {"1", "2", "3", };

and then want to do:

for(i=0; i<3; i++){
  c[i]++;
}

that will produce c[] = {"2", "3", "4"}

Basically, your question is unclear....
0
 
LVL 5

Author Comment

by:alanwhincup
ID: 6235961
Sorry about the unclear question.. I was in a bit of a rush... I dont know why i even had to ask it ??? Anyways the points are yours jhance.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now