12-09-2009
If you use calloc it will initialize all memory locations to zero before returning.
9 More Discussions You Might Find Interesting
1. Programming
When run it, segment fault.
What is wrong?
#include <stdio.h>
#include <stdlib.h>
const int max =20;
//****************************************************
// Input Matrix
//****************************************************
void inMatrixAA(int *AA, int row, int col)... (9 Replies)
Discussion started by: zhshqzyc
9 Replies
2. IP Networking
I do have 2 different segment network which different platform on each segment. E.g. 20 segment, Windows OS can talk to Unix OS and 21 segment practice same rule. Further more, Windows OS from 20 segment can talk to 21 segment other OS but only the UNIX OS in 20 segment fail to talk to 21 segment.... (3 Replies)
Discussion started by: HASM
3 Replies
3. Shell Programming and Scripting
Hey all, could someone please direct me on how to extract a segment from a file between two tags? Thanks! (1 Reply)
Discussion started by: mpang_
1 Replies
4. HP-UX
I'm not an HP-UX Admin professional, but rather a Lawson ERP installer. I'm looking for clues on how to troubleshoot this issue. I have WAS 6.1 ND running on HP-UX 11.23 PA-RISC with the Lawson ERP application . When I start the Lawson application, no errors arise. When I start WAS app server, an... (4 Replies)
Discussion started by: mrvitas
4 Replies
5. Shell Programming and Scripting
Hi,
I am using bash. My question concerns cutting out segments of a string. Given the following filename:
S2002254132542.L1A_MLAC.x.hdf
I have been able to successfully separate the string at the periods (.):
$ L1A_FILE=S2002254132542.L1A_MLAC.x.hdf
$ BASE=$(echo $L1A_FILE | awk -F.... (5 Replies)
Discussion started by: msb65
5 Replies
6. UNIX for Dummies Questions & Answers
how do i close a do code segment? od? (1 Reply)
Discussion started by: trob
1 Replies
7. Programming
Hi to all.
I'm reciving a "Segment violation" error from this code and I don't know why.
void insertAtEnd(NodeType *pList) {
char element;
printf("Introduce a element: \n");
setbuf(stdin, NULL);
scanf("%c", &element);
//Find the end of the list;
while... (4 Replies)
Discussion started by: daniel.gbaena
4 Replies
8. Programming
Hi,
Whether the following piece of code is placed in the read-only memory of code (text) segment or data segment?
char *a = "Hello";
I am getting two different answers while searching in google :( that's why the confusion is (7 Replies)
Discussion started by: royalibrahim
7 Replies
9. Programming
I always get segment fault, why? can sb help me and modify it, I have spend on much time on
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>
#define MAX 10
pthread_t thread;
void *thread1()
{
int *a;
int i, n;
... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
LEARN ABOUT MOJAVE
memory
MEMORY(3) BSD Library Functions Manual MEMORY(3)
NAME
alloca, calloc, free, malloc, mmap, realloc -- general memory allocation operations
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
void *
alloca(size_t size);
void *
calloc(size_t nelem, size_t elsize);
void
free(void *ptr);
void *
malloc(size_t size);
void *
realloc(void *ptr, size_t size);
#include <sys/mman.h>
void *
mmap(void * addr, size_t len, int prot, int flags, int fildes, off_t off);
DESCRIPTION
These functions allocate and free memory for the calling process. They are described in the individual manual pages.
LEGACY SYNOPSIS
#include <sys/types.h>
#include <sys/mman.h>
void *
mmap(void * addr, size_t len, int prot, int flags, int fildes, off_t off);
The include file <sys/types.h> is needed for this function.
COMPATIBILITY
mmap() now returns with errno set to EINVAL in places that historically succeeded. The rules have changed as follows:
o The flags parameter must specify either MAP_PRIVATE or MAP_SHARED.
o The size parameter must not be 0.
o The off parameter must be a multiple of pagesize, as returned by sysconf().
SEE ALSO
mmap(2), alloca(3), calloc(3), free(3), malloc(3), realloc(3), compat(5)
STANDARDS
These functions, with the exception of alloca() and mmap() conform to ISO/IEC 9899:1990 (``ISO C90'').
BSD
June 4, 1993 BSD