anand
having function pointers inside struct is of no
use because unnecessarily you are increasing the
size of struct and it serves no purpose because
other than calling the function in other way around
you achive nothing using function ptrs inside struct
in c
in cpp public and private are...
friend i also tried curses but there is some
problem with the header and library in solaris forte c++
if you want to clear the screan using unix utility
do this
#include<stdlib.h>
main()
{
system("clear");//this clears the screan
//your code
}
see if it helps
anand ,
i have already in my previous reply suggested
that there is no equivalent of c++ virtual functions in
c .reason c has only compile time binding while cpp
apart from compile time binding has run time binding
implemented by VTABLE AND VPTRS .
so for your task write different functions for...
this is a rough template which i think would
give you some idea ,remember you can write fns
inside a struct but in standard c program you shouldnot
other thing is concept of virtual function is not
appicable in c for in c there is always early binding
last thing whenever you call a function...
bluenote,
first the reason of error its because of array index
out of bound ,you started from index 1 use index o to
start and the problem finishes
second the programme which you wrote is excellent to start
with but to solve Mac's problem you have to allocate two
blocks of memory from heap...
kaotic try this and let me know if its ok
fprintf(writefile1, "%-5d%-15s%-35s\n", id, botanical, common);
change the no as required
let me know if it helped
yogesh
yes kaotic there is a problem there
what has happened is
the entire expression of your if is evaluated due
to braces and even if one file is successfully opened
the result is true
so open the file individually and check with the
condition
or if you want in a single line change as you have...
kaotic,
there is absolutely no problem in this part of your code
and there is no segmentation fault in this part
it may be a a minor compile
time fault depending upon you compiler but that has
to do with the line seperator
there may be segmentation fault in other parts
this part of your...
friend this is what you want ,compile it and enjoy
this is one way with arrays
but it can be done more efficiently with dynamic allocation
but this is ok
#include <stdio.h>
#include <string.h>
#define MAXLIN 250
#define MAXLINE 250 //this refers to the max line you
//have...
i agree with lim ,i would just add onething more
when you are trying to access memory without improperly
you get core dumped .its a way that the operating system
doesnot lets you get unauthorised access to a memory segment
you will get this with array,strings and anthing which
deals with...
LIM, in unix the basic architecture is as i said before
correct me if its wrong
we are given a process area
this area has four parts
1.the code segment which doesnot change
2.the data segment which has two parts
a.initialized data
b.uninitialized
3.stack segment which is at the top of the...
friends i asked you about this and after finding
the things manually i conclude
1.all global stored in data segment
2.all locals and func parameteres stored in stack segment
3.function static or otherwise stored in code segment
(it may be called the initialized data segment which may be...
all gurus
i am totally confused with the storage in c/c++
where is ptr variable,static variable etc be stored with
respect to datasegment and stack segment .please
clear my doubts
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.