Hey all,
I have decided that in order to learn i will need to write code. So i am working on all the questions on my book. And as I am teaching myself i end up with no-one to scrutinize my code.

#include <iostream>

/************Declarations of Functions*********/
	void func1();
	void func2();
//=============================================Tue 28 Apr 2009 18:37:48 IST//
/* Global Test Variables */

	int const max_length=18;
	int quest_count=0 ;
	char input_line[max_length]="???sky???";

int main()

	func1();// Character string with While loop
	std::cout<<"No Of Question Marks = " << quest_count<< "\n";
	func2();//Pointer Based Passing.
	std::cout<<"No Of Question Marks(Pointer Based) = " << quest_count<< "\n";

void func1()
	int i=0;

void func2()

	char *ptr=input_line;


The above program counts the number of "?" marks in a string passed to it.

I would like to recieve comments on the code :) and any improvements that can be made.

I think it would be more useful if one could pass the string into a method and have it return the number of question-marks found (as an unsigned int, or in extraordinary cases an unsigned long int).

long time, no see :D

I would define a constant char for the '?' comparer. If you want to change the compare criteria, you only have to change it once.

This question has already been answered. Start a new discussion instead.