![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Which Base Level Filesets needed by a specific program? | cypher82 | UNIX for Advanced & Expert Users | 4 | 05-29-2008 09:07 AM |
| Help needed regarding c program | dwgi32 | High Level Programming | 2 | 11-19-2007 10:44 AM |
| Wierd thing about FSs and VGs | mhenryj | AIX | 4 | 11-13-2007 04:42 PM |
| Wierd results with awk | amatheny | Shell Programming and Scripting | 2 | 11-01-2007 06:12 PM |
| Wierd Message???? | lesstjm | UNIX for Dummies Questions & Answers | 6 | 01-04-2002 10:01 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Wierd C program. Help Needed
Hi,
Please see this: When i make a declaration as: char *i, j[15], *k; and then do sprintf( k, "print.sh %s", i ); the program works fine. But when i change the declaration to: char *i, *k; and then do sprintf( k, "print.sh %s", i ); I get a segmentation fault at the 'sprintf' statement. The program works only when j is an array of 15. Nothing less/more ![]() Please Note: variable j is just a dummy. I do absolutely nothing with it. Also, i know using sprintf the way i have done is illegal. The pointer is not assigned to anything, prior to such a statement. It may be silly but could someone please explain why this happens? Guess something to do with the way memory is allocated.Thanks in advance! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|