Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8810281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:05:26+00:00 2026-06-14T03:05:26+00:00

This is my program: #include <stdio.h> #define uart0 0x860 #define uart1 0x880 void send_char(

  • 0

This is my program:

#include <stdio.h>

#define uart0 0x860
#define uart1 0x880

void send_char( int output )
{
    int nothing;
    //while write on uart1 is not ready, wait
    while(!((*(uart1+8) & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
    {
        nothing = 0;

    }
    *(uart1+4) = output; // +4 eller +1? en byte (4 bitar)
}

int rec_charx(void)
{
    if(!((*(uart1+8) & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
    {
        return *(uart1) & 0x000f;
    }
    else
    {
        return -1;
    }
}

The compiler complains:

expected ‘)’ before ‘output’

Why? How can I fix it? I don’t understand the complaint.

Update

We’ve rewritten to program but we still get compilation errors:

#include <stdio.h>

static int* const uart1 = (int*) 0x880;

void send_char( int output )
{
    int nothing;
    //while write on uart1 is not ready, wait
    while(!((uart1[2] & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
    {
        //do nothing
        nothing = 0;

    }
    uart1[1] = output; // skriv till uart1
}

int rec_charx(void)
{
    if(!((*(uart1+8) & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
    {
        return *(uart1) & 0x000f;
    }
    else
    {
        return -1;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:05:27+00:00Added an answer on June 14, 2026 at 3:05 am

    You need to use constants instead of those defines:

    #define uart0 0x860
    #define uart1 0x880
    

    like so:

    const int * uart0 = 0x860;    
    const int * uart1 = 0x868;
    

    Also noted that incrementing a pointer of type int * by 1, moves it pointing to and address +sizeof(int*). So assuming an int being 4 bytes long, uart1 + 1 would point to address 0x884.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am studying pointers and I encountered this program: #include <stdio.h> void swap(int *,int
After doing lot of research in Google, I found this program: #include <stdio.h> int
In this C program #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> int main()
can any one give me the dry output for this program? #include <stdio.h> main()
My program is like this ( main.c ): #include <stdlib.h> #include <stdio.h> void main(){
Consider this program: #include <stdio.h> int main() { printf(%s\n, __FILE__); return 0; } Depending
Consider this demo program: #include <stdio.h> class Base { public: virtual int f(int) =0;
I have this small program: #include <stdio.h> #include <string.h> #include <ctype.h> #define SIZE 30
Consider this little program: #include <stdio.h> int main() { char c = 0xFF; printf(%d\n,
In this c program #include<stdio.h> int main() { #if UnDefinedSymbolicConstant==0 printf(UnDefinedSymbolicConstant is equal to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.