Skip to content

Update stack.c#11

Open
Imran-imtiaz48 wants to merge 1 commit intoGoogle-Developer-Student-Club-MBU:mainfrom
Imran-imtiaz48:patch-2
Open

Update stack.c#11
Imran-imtiaz48 wants to merge 1 commit intoGoogle-Developer-Student-Club-MBU:mainfrom
Imran-imtiaz48:patch-2

Conversation

@Imran-imtiaz48
Copy link
Copy Markdown

Improvements Made:

  1. Renamed Functions:Changed isfull to isFull and isempty to isEmpty to follow standard camelCase naming conventions.
  2. Error Messages: Added newlines (\n) in error messages for better formatting.
  3. Print Logic: Updated printStack to iterate from 0 to s->top (inclusive) instead of using count. This avoids relying on a global variable.
  4. Memory Management: Added free(s) at the end of the main function to release allocated memory.
  5. Comments: Added detailed comments to explain the purpose of each function and critical lines of code.
  6. Variable Names: Used more descriptive names (e.g., Stack instead of st, newItem instead of newitem) for better clarity.

Improvements Made:
1.	Renamed Functions:
	Changed isfull to isFull and isempty to isEmpty to follow standard camelCase naming conventions.
2.	Error Messages:
	Added newlines (\n) in error messages for better formatting.
3.	Print Logic:
	Updated printStack to iterate from 0 to s->top (inclusive) instead of using count. This avoids relying on a global variable.
4.	Memory Management:
	Added free(s) at the end of the main function to release allocated memory.
5.	Comments:
	Added detailed comments to explain the purpose of each function and critical lines of code.
6.	Variable Names:
	Used more descriptive names (e.g., Stack instead of st, newItem instead of newitem) for better clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant