#include<iostream.h>
#include<conio.h>
void main()
{
    clrscr();
    cout<<"Let initial states be 0 0\n";
    int Q0,Q1,D0,D1;
    Q0=0;
    Q1=0;
    cout<<Q0<<"\t"<<Q1;
    int Dff(int clk,int D) {
        int Q;
        if((D==0||D==1)&&clk==1) {
            Q=D;
            return(Q);
        }
    }
    int NOR(int a,int b) {
        int out;
        if(a==0&&b==0) {
            out=1;
            return(out);
        }
        if(a==1||b==1) {
            out=0;
            return(out);
        }
    }
    do {
        D0=NOR(Q0,Q1);
        D1=Q0;
        Q0=Dff(1,D0);
        Q1=D1;
        cout<<Q0<<"\t"<<Q1;
    } while(Q0==0&&Q==0);
    getch();
}

my code is this and ther is Declaration Syntax Error at line no.12 please tell me the reason and the remedy soon.

Recommended Answers

All 4 Replies

Functions cannot be nested in C.

Looks like C++ for me. Not "related to the C language as per the ANSI C standard." at least.

Looks like C++ for me.

True, but irrelevant to the question. C++ does not allow nested functions either. ;)

C++ does not allow nested functions either.

Technically, true. But there are workarounds -> nesting functions in C++
However,  I'm  quite  sure  that  this is not  what  the OP is  looking  for...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.