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

  • Home
  • SEARCH
  • 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 570181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:22:25+00:00 2026-05-13T13:22:25+00:00

I am trying to write a very simple application that allows me to enter

  • 0

I am trying to write a very simple application that allows me to enter a number which will allocate a particular grade.

I’ve not used the C language very much as i primarily use C# however i still don’t seem to be able to get around the errors:

They are all syntax errors, ranging from “if” to “{” although i’m sure everything is as it should be.

One i don’t understand is the “void illegal with all types” at the grade = assess(mark);
section.

I understand the program may not product the correct output but im simply trying to get it to compile.

Thank you for your help, i imagine I’m doing something REALLY obvious.

Task.c

#include <stdio.h>
#include <string.h>

//Protoype
void assess(int* mrk);

// Main method (start point of program)
void main()
{

 int mark;
 char grade;


 printf("enter a word: ");
 scanf("%d", &mark);

 grade = assess(mark);



 printf("That equals ");
 printf("%c", grade);
 printf(" when marked\n");
}


char assess(int* mrk)
{
 char result;

 if(mrk > 0 && <= 100)
 {
  if(mrk < 35)
  {
   result = "f";
  }
  if(mrk >= 35 && <= 39)
  {
   result = "e";
  }
  if(mrk >= 40 && <= 49)
  {
   result = "d";
  }
  if(mrk >= 50 && <= 59)
  {
   result = "c";
  }
  if(mrk >= 60 && <= 69)
  {
   result = "b";
  }
  if(mrk > 70)
  {
   result = "a";
  }
 }
 else
 {
  result = "error";
 }

 return result;
}
  • 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-05-13T13:22:25+00:00Added an answer on May 13, 2026 at 1:22 pm

    mrk is declared as a pointer to an int but you are not dereferencing it.

    Replace

    char assess(int* mrk) 
    

    with

    char assess(int mrk)
    

    in the definition of assess

    Similarly, you declared (prototyped) assess as

    void assess(int* mrk)
    

    Replace with

    char assess(int mrk)
    

    Next,

    if(mrk >= 35 && <= 39)
    

    is not legal syntax. I know it reads like mrk is greater than or equal to 35 and less than or equal to 39 but you have to be more explicit for the compiler. So

    replace

    if(mrk >= 35 && <= 39)
    

    with

    if(mrk >= 35 && mrk <= 39)
    

    and similarly throughout.

    Next, in assess you have declared result as a char but you are assigning char *s to result. Replace

    result = "f";
    

    with

    result = 'f';
    

    and similarly for all assignments to result. In particular

    result = "error";
    

    should be something like

    result = 'z'; /* 'z' indicates failure */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a very simple Android application that checks the signal
Im trying to make a very simple application that lets my client create their
Trying to write a PowerShell cmdlet that will mute the sound at start, unless
I'm trying to write a regex function that will identify and replace a single
I am trying to write an application that performs operations on a grid of
I'm trying write a query to find records which don't have a matching record
I'm trying to write a blog post which includes a code segment inside a
I'm trying to write a custom WPF ValidationRule to enforce that a certain property
I am trying to write a unit test for an action method which calls
I'm trying to write a stored procedure to select employees who have birthdays that

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.