Program that checks if a String has balanced parenthesis/bracket/curly brace.
Overview
The goal of this project is to get used to working with the following topics in C:
- Dynamic memory allocation
- Pointers
- Reading from stdin
Project Instructions
Create a C program (named parentheses.c
) that will:
- Create a function that accepts will check if a single string is a valid string.
- Accept strings from stdin until an EOF signal is received (each string will be on it's own line).
- For each string, call the function you created in step 1 to check if the string contains valid parentheticals:
- A string is valid if every open parenthesis/bracket/curly brace is closed by the correct brace and nested correctly
- Example 1:
(djfk[kfdsj{012}hello]world)
is valid - Example 2:
(hello[how{are]youtoday})
is not valid because the closing]
is encountered before the closing}
- Example 3:
(()[{()}][])
is valid - Example 4:
[(a)(b)(c){d[b]}
is not valid because there is no closing]
matching the first opening[
.
For every string, print out a line that simply says VALID
or NOT VALID
(this will be case sensitive). These lines should occur in the same order the strings are read in and there should be no additional lines or additional text.
Hints: there may be other characters in addition to parentheses, curly braces, and brakcets. However, these characters will not affect whether the string is valid (only the parenthetical type characters matter).
Get Help With a similar task to - Program that checks if a String has balanced parenthesis/bracket/curly brace.
Related Questions
Tutlance Experts offer help in a wide range of topics. Here are some of our top services:
- Math homework help
- Nursing homework help
- Statistics homework help
- Nursing coursework help
- Capstone project writing services
- Essay writers for hire
- Case study writing help
- Buy college papers online
- Buy college research papers
- College homework help
- Professional resume writing services
- Programming homework help
- Coursework writing help
- Term paper writing help
- Biology homework help
- Do my physics homework
- Dissertation data analysis help
- PhD Dissertation writing services
- Chemistry homework help
Post your project now for free and watch professional experts outbid each other in just a few minutes.