06-20-2011
A pointer isn't a magical type that knows what you want it to do. It's just a numerical type with extra operators, = still means=. Ergo, when you use = on it, you're telling it to point to a completely different spot in memory. If you want to preserve memory you already have, you have to use string operations or array operations to copy it in.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I would like to know how I could allocate some more memory to a process.
Please note that I am not the root user. (1 Reply)
Discussion started by: sagar
1 Replies
2. Programming
Hi,
I am trying to process line by line of a file. But I should not be allocating static allocation for reading the contents of the file. The memory should be dynamically allocated. The confusion here is how do I determine the size of each line, put it into a buffer with the memory allocated... (11 Replies)
Discussion started by: naan
11 Replies
3. Programming
Hi,
I have the following problem: i must allocate a dynamic array from a subroutine which should return such array to main function. The subroutine has already a return parameter so i thought of pass the array as I/O parameter. I tried the following program but it doesn't work (segmentation... (11 Replies)
Discussion started by: littleboyblu
11 Replies
4. Programming
I have a program that will fetch some particular lines and store it in a buffer for further operations.The code which is given below works but with some errors.I couldn't trace out the error.Can anybody help on this plz??
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#define... (1 Reply)
Discussion started by: vigneshinbox
1 Replies
5. Programming
Hi,
is it possible in C to allocate dynamically a global variable?? (3 Replies)
Discussion started by: littleboyblu
3 Replies
6. Programming
I have a scenario like the client has to search for the active server.There will be many servers.But not all server are active.And at a time not more than one server will be active.
The client will be in active state always i.e, it should always search for an active server until it gets one.I... (1 Reply)
Discussion started by: vigneshinbox
1 Replies
7. Programming
i wrote a tiny version of tail command using a large buffer statically allocated but, in a second time, i found another version in which i use a bidimensional array dynamically allocated.
here is the first version
/*my tiny tail, it prints the last 5 line of a file
*/
#include<stdio.h>... (4 Replies)
Discussion started by: lucasclaus
4 Replies
8. Programming
Hi Experts
I need some help in static memory allocation in C. I have a program in which I declared 2 variables, one char array and one integer. I was little surprised to see the addresses of the variables.
First:
int x;
char a;
printf("%u %u\n', &x, a);
I got the addresses displayed... (2 Replies)
Discussion started by: unx_freak
2 Replies
9. Shell Programming and Scripting
hello all..
i'm a beginner in shell scripting. I need to know what is really happening when we are creating a variable in shell scripting? how memory is allocated for that variable? (3 Replies)
Discussion started by: aarathy
3 Replies
10. Programming
Hello,
I am new to C++ programming, so I'm still getting a feel for things. I recently wrote a simple C++ program (to be used as a ROOT Macro) to conduct a statistical analysis of a varied version of the Monty Hall problem (code below). Basically, the programs runs a few simple calculations to... (7 Replies)
Discussion started by: Tyler_92
7 Replies
LEARN ABOUT HPUX
xmreptypegetregistered
XmRepTypeGetRegistered(library call) XmRepTypeGetRegistered(library call)
NAME
XmRepTypeGetRegistered -- A representation type manager function that returns a copy of the registration list
SYNOPSIS
#include <Xm/RepType.h>
XmRepTypeList XmRepTypeGetRegistered(void)
DESCRIPTION
XmRepTypeGetRegistered retrieves information about all representation types that are registered with the representation type manager. The
registration list is an array of structures, each of which contains information for a representation type entry. The end of the registra-
tion list is marked with a representation type entry whose rep_type_name field has a NULL pointer. This routine allocates memory for the
returned data. The application must free this memory using XtFree.
The representation type entry structure contains the following information:
typedef struct
{
String rep_type_name;
String *value_names;
unsigned char *values;
unsigned char num_values;
Boolean reverse_installed;
XmRepTypeId rep_type_id;
} XmRepTypeEntryRec, *XmRepTypeList;
(void)
rep_type_name
The name of the representation type
value_names
An array of representation type value names
values An array of representation type numerical values
num_values
The number of values associated with the representation type
reverse_installed
A flag that indicates whether or not the reverse converter is installed
rep_type_id
The identification number of the representation type
RETURN
Returns a pointer to the registration list of representation types.
RELATED
XmRepTypeRegister(3) and XmRepTypeGetRecord(3).
XmRepTypeGetRegistered(library call)