I have written the following.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(void) {
int i, pid;
pid = fork();
Type: Posts; User: modec
I have written the following.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(void) {
int i, pid;
pid = fork();
just forget the last post. i used "new" and member pointers and now it works smooothly.
int main ()
{
list<Member *> mlist;
Member memtest;
Employee emptest;
int ans;
string buf;
cout << "What do you want to put?" << endl
<< "Member (1) - Employee (2) ? : ";
#include <iostream>
#include <string>
#include <list>
using namespace std;
class Member {
string name;
public:
Member(string name) {
this->name = name;
In a class i have many string (#include <string>) variables. In the destructor do i have to do anything special for the string? i tried delete name_of_string and the compiler complains that delete...
letdef struct list_tag * list;
struct list_tag {
enum {
.....
} kind;
struct {
int x;
struct {
int y;
i m working with six header files and six source files, thats why i couldn't post it all. I was hoping for a short easy answer. it must be a scope thing which i can't sort out.
first of all it is a valid struct Type_tag object. secondly i put the ... in the next line and i get the error on the line where the (symbolentry->type) is
typedef struct Type_tag * Type;
struct Type_tag {
enum {
TYPE_unit,
TYPE_bool,
TYPE_char,
TYPE_int, ...
I have the following declarations:
typedef struct SymbolEntry_tag * SymbolEntry;
struct SymbolEntry_tag {
Identifier id;
Scope scope;
...
or you can use if
if (x < 0)
x = -x;
or
x = (x > 0)? x : (-x);
If you type tab the compiler will see the ascii character 9. that's how he can distinguish between the two.
ok i got it. I was thinking of a tab as many spaces. But printf doesn't print many spaces, it moves to the next tab stop. So i was thinking that printf makes a mistake when it prints a single...
i used gdb to debug.
Hardware access (read/write) watchpoint 3: yytext
Value = 0x93c70 "'\t'"
0x00003c38 in main () at lexin.c:107
107 printf( "token = %d, lexeme =...
i m using flex to write the lexical analyser and i have the following prob:
this code
//other stuff for flex
int main ()
{
int token;
ok, i know about the escape sequences \n \t \r etc. But i m asking: considering that newline is a single character is the following acceptable?
char c = '
';
the reason i m asking is because...
i didn't catch your post itsme86. It is probably the devc++ editor's fault. is the newline considered a single character?
c = '
';
thanks for the replys. i tried the same code (the one i posted) in cygwin (gcc) and the output was :
"a a" (a [tab] a). can anyone explain why this difference?
#include <stdio.h>
int main()
{
char c = ' '; /* I typed tab here */
printf("a%ca\n", c);
return 0;
}
thanks everyone. itsme86 the function is exactly the same for the two types and using long for both long and char inputs works just fine.
Can you have a function that has an argument that could be either one type or another. For example foo(x input) where x is either char or long int? should i look into enums?
I guess someone has heard of the programs that when executed print their code like this one :
#include <stdio.h>
main()
{
char*p="main(){char*p=%c%s%c;printf(p,34,p,34,10);}%c";
...
I'm trying to install gtk for devc++. I have downloaded two files gtk-runtime.exe and gtk-dev.zip. Could someone tell me what to do with those files? Documentation hasn't helped me, i tried several...
#include <conio.h>
int getch();
FAQ
is there a way to read input from the keyboard while the user enters it. before he presses return.