LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-21-2019, 07:01 PM   #1
FOSSilized_Daemon
Member
 
Registered: Mar 2019
Distribution: OpenBSD/Alpine Linux
Posts: 123

Rep: Reputation: Disabled
E1_8.c:16:4: error: expression is not assignable


I am doing an assignment where I need to count tabs, newlines and spaces. I have this code

Code:
#include <stdio.h>

int main() {

        int c, nl, bl, tb;

        nl = 0;
        bl = 0;

        tb = 0;

        while ((c = getchar()) != EOF)
                if (c == '\n')
                        ++nl;
                else (c == '\t')
                        ++bl;
        printf("%d\n", bl);
        printf("%d\n", nl);

}
This returns this error:

Code:
E1_8.c:16:4: error: expression is not assignable
                        ++bl;
                        ^
1 error generated.
I am confused...
 
Old 05-21-2019, 07:05 PM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19.1 MATE
Posts: 8,007
Blog Entries: 5

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
else if
 
5 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] jhalfs sed: -e expression #1, char 55:Invalid preceding regular expression percy_vere_uk Linux From Scratch 10 07-22-2017 07:15 AM
Bash - assignable "false" value genese Programming 6 08-22-2012 09:53 AM
Error: .size expression for do_hypervisor_callback does not evaluate to a constant saman_artorious Linux - Software 0 08-15-2012 06:48 AM
Regular expression matching , match "error string" but not "other error" jmcmillan Programming 3 07-07-2008 09:50 AM
looking for a sound sampler with assignable key bindings mentaltofu Linux - Software 0 02-06-2006 05:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration