TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CHRISTIAN FELDE
from: ERIC LONDAITS
date: 1998-01-24 08:25:00
subject: This work`s, but...

El Jueves 22 Enero 1998 a las 17:06, Christian Felde le dijo a All:
 CF> This program works, but it seams like when I give more the 3 char's in
 CF> to array 2, I get this: "Segmentation fault (core dumped)"
Arrays are declared like this:
char array[ARRAY_SIZE]
but, when accesing the array's elements keep in mind that the first index is 
0, so a two element array (e.g.
    char array[2]
) would have these two elements: array[0] and array[1], array[2] would be a 
third element, and out of bounds considering the declared array.
 CF>         cout << "Enter array 1: ";
 CF>         cin >> array[1];
         cin >> array[0];
 CF>         cout << "Enter array 2: ";
         cin >> array[1];
Now that's better! :)
 Eric Londaits
 wocky@usa.net
--- GoldED/2 2.50 UNREG
---------------
* Origin: Rocketman Point (4:900/265)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.