language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_mate.c :+: :+: :+: ... |
C | #include "main.h"
/**
*_islower - check for lowercase characters
*
*@c : the number to be traced
*Description: checks for lowercase
*Return: 0 if false & 1 if true
*/
int _islower(int c)
{
return (c >= 'a' && c <= 'z');
}
|
C | #include <stdio.h>
#include "lexer.h"
void TokenPrint(TokenT *token) {
char *id = "?";
int i;
if (token->id == TOK_LBRACKET)
id = "[";
else if (token->id == TOK_RBRACKET)
id = "]";
else if (token->id == TOK_LBRACE)
id = "{";
else if (token->id == TOK_RBRACE)
id = "}";
else if (token->id... |
C | #include <stdio.h>
#include "add.h"
#include "divide.h"
int main(){
printf("%lf\n", add(7,5) );
printf("%lf\n", divide(6,2));
return 0;
} |
C | /*
* Using function memmove
* To compile:
* $ gcc fig08_29.c -o fig08_29
*/
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[] = "Home Sweet Home"; // initialize char array s
printf("string s before memmove is: %s\n", s);
printf("string s after memmove is: %s\n", (char *) memmove(s, &s[5... |
C | #include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "symbol_table.h"
#ifndef OUTPUT_H
#define OUTPUT_H
/* Writes an object file (*.ob) with the given instruction/data memory content.
* Returns true on success and false on error. */
bool writeObjectFile(const char *name, unsigned short *iMemory, int... |
C | /* Kyle Seelman
CPSC 1010 Lab, Spring 2017
Lab #1
My first "hello world" program.
*/
#include <stdio.h>
int main(void)
{
printf ("Hello world\n");
printf ("Hello world\n");
printf ("Hello world\n");
printf ("Hello world\n");
printf ("Hello world\n");
printf ("Hello world\n");
printf ("Hello world... |
C | //
// limits.h
//
// this is for a 32-bit x86 system
//
// written by sjrct
//
#ifndef _LIMITS_H_
#define _LIMITS_H_
// the byte size on the machine
#define CHAR_BIT 8
// char limits
#define SCHAR_MAX 0x7f
#define SCHAR_MIN 0xff
#define UCHAR_MAX 0xff
//
// limits of chars without regard to sign
//
// th... |
C | /* ヘッダファイルのインクルード */
#include <stdio.h> /* 標準入出力 */
/* main関数の定義 */
int main(void){
/* 変数の初期化 */
int a = 10; /* aを10に初期化. */
const int b = 100; /* bは100とする.(constが付いているので定数として扱われる. */
/* 配列・ポインタの初期化 */
char str1[] = "ABC"; /* str1に"ABC"という文字列をセット. */
char str2[] = "DEF"; /* str2に"DEF"という文字列をセット. */
cons... |
C | #include "pogodi_broj.h"
#define ANSI_COLOR_CYAN "\x1b[36m"
#define ANSI_COLOR_RESET "\x1b[0m"
int pretrazivanje_pokusaja(int niz[], int kljuc) // Pretrazuje da li smo 2x unijeli isti broj
{
int i;
for( i=0; i<5; i++)
{
if(niz[i] == kljuc)
return 1;
}
return 0;
}
int gene... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include<netdb.h>
int main()
{
int sock,rsock, sender_fd,reciever_fd, bytes_recieved , true = 1;
int R_PORT; ... |
C | //Pattern printing-6
// 4 3 2 1 1 2 3 4
#include<stdio.h>
void Display(int iVal)
{
int iCnt=0;
for(iCnt=iVal;iCnt>=1;iCnt--)
{
printf("%d ",iCnt);
}
for(iCnt=1;iCnt<=iVal;iCnt++)
{
printf("%d ",iCnt); //static data
}
}
int main()
{
int iValue=0;
printf("Please ent... |
C | /*
* shell_insert_sort.c
*
* Created on: Aug 14, 2016
* Author: leo
*/
/*
* shell_insert_sort.c
*
* Created on: Aug 14, 2016
* Author: leo
*/
#include <stdio.h>
#include <stdlib.h>
void shell_insert_sort(int a[],int n,int div)
{
int i = 0,j = 0,x = 0;
for(i=div;i<n;++i)
{
if(a[i]<a[i-div])
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* asm.c :+: :+: :+: ... |
C | // 1º Exercício da lista de Structs
#include <stdio.h>
typedef struct {
int hora;
int minuto;
int segundos;
} Horario;
typedef struct {
int dia;
int mes;
int ano;
} Data;
typedef struct {
Data data;
Horario horario;
char * texto;
} Compromisso;
int main()
{
... |
C | //==============================================//
// //
// Point //
// //
//----------------------------------------------//
// File : point.h */ //
//-----------------... |
C | #include "SomeObject.h"
/* 虚函数的实现 */
void some_object_method1_impl (SomeObject *self, gint a)
{
self->m_a = a;
g_print ("Method1: %i\n", self->m_a);
}
void some_object_method2_impl (SomeObject *self, gchar* b)
{
self->m_b = b;
g_print ("Method2: %s\n", self->m_b);
}
/* 公有方法 */
void some_object_method1 (SomeObject... |
C | #include <stdio.h>
int prime(n)
{
int i, r;
int flag = 0;
r = sqrt(n);
for(i = 2; i <= r; i++){
if(n % i == 0){
flag = 1;
break;
}
}
if(n == 1)
return 0;
else if(flag == 1)
return 0;
else
return n;
}
int main()
{
int i, ... |
C | /*
* File: products.c
* Author: morris
*
* Created on January 28, 2015, 9:14 PM
*/
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
int main(int argc, char** argv) {
float salesTotal=0,items[2],cost[2];
int i;
for (i=0;i<2;i++ ){
printf("Enter The price of item %d: ",i+1);
scanf("... |
C | #include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include <string.h>
#include <unistd.h>
#include "time.h"
int coffee(int Hours, int Mins)
{
// read the current time
time_t now = time (NULL);
// convert it to local time
struct tm tm_now = *localtime (&now);
// Create an HHMM chain... |
C | //Koral nataf 208726257
//and
//Gal or 316083690
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "equation.h"
#include "allEquations.h"
#include "solver.h"
#include "general.h"
int main() {
int number;
printf("Number of equations: (1-3): ");
scanf("%d", &number);
getchar();
while (number < 1... |
C | #include <stdio.h>
int main(void)
{
int min, max, sum;
/* 入力部分 */
printf("最小値と最大値を, で区切って入力してください\n");
scanf("%d, %d", &min, &max);
/* 計算部分 */
sum = (max-min+1)*(min+max)/2;
/* 出力部分 */
printf("%d〜%dの合計は%dです\n", min, max, sum);
return 0;
}
|
C | #include<stdlib.h>
#include<stdio.h>
#include<malloc.h>
/* Author Amit Sangwan
Copyright 2016
linked list file to create some operation on dym=namic memory allocation like insertion,travel
search and deleted element from the linked list
*/
struct node{
int data;
struct node *next;
};
void Insert(void);
int Se... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int first_tree = 150;
int second_tree = 142;
int third_tree = 127;
int total_apples = first_tree + second_tree + third_tree;
printf("Apples gathered = %d", total_apples);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define s_laenge_max 100
int gibZahlenEin(double f[]) {
int z = 1;
int n;
int rv = 0;
char s[s_laenge_max];
double zahl;
printf("Ihre Zahlen\n\n");
do {
do {
printf("Zahl%d: ", z);
fgets(s, s_laenge_max, stdin);
fflush(st... |
C | /* Chapter 3 Exercises 3, 4, 5 */
#include <stdio.h>
int main(void) {
/* Exercise 3 */
// int i, j, k;
// printf("Enter an int: ");
// scanf("%d", &i);
// printf("Enter another int: ");
// scanf(" %d", &j);
// printf("%d,%d", i, j);
// printf("Enter 3 ints: ");
// scanf("%d -%d -%d", &i, &j, &k);
/... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <dirent.h>
#include <errno.h>
int main(int argc, char* argv []){
pid_t child;
int status;
if(argc != 2){
printf("usage: tryit command\n");
ex... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#define UNIX
#include <CAENHVWrapper.h>
#include <watchHV.h>
int main()
{
// set params to default values
// options: ISet, MaxV, RUp, RDwn, Trip, VSet
int res = -1;
float ISet = 200., MaxV = 1800., RUp = 100., RDwn = 150., VSet = 10.;
for (ushort chNu... |
C | #include <stdio.h>
int main()
{
int n,temp,i=0,j,r[20],seed=1;
scanf("%d",&n);
temp=n;
while(temp)
{
r[i++]=temp%10;
temp/=10;
}
for(j=0;j<i;j++)
{
seed=seed*r[j];
}
printf("%d\n",seed*n);
return 0;
}
|
C | #define _CRT_SECURE_NO_WARNINGS 1
//дһжһַǷΪһַתַ֮
//磺s1 = AABCDs2 = BCDAA1
//s1 = abcds2 = ACBD0.
//AABCDһַõABCDA
//AABCDַõBCDAA
//AABCDһַõDAABC
//#include<stdio.h>
//#include<string.h>
//#include<Windows.h>
//#include<stdlib.h>
//int fun(char str1[], char str2[])
//{
// int n1 = strlen(str1);
// //int n2 = strlen(str2)... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:4996)
//
#include <stdio.h>
#include <windows.h>
#include <math.h>
void change1(int* x, int* y);
void change2(int* x, int* y);
void change3(int* x, int* y);
int main()
{
int x = 0, y = 0;
printf(":");
scanf("%d%d", &x, &y);
change1(&x, &y);
printf("%d %... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char const *argv[]) {
char frases[5][50],nomeArquivo[30],c;
printf("Nome do arquivo> " );
fgets(nomeArquivo,sizeof(nomeArquivo),stdin);
int j = 0;
for (size_t i = 0; i < 5; i++) {
printf("%zu frase >",i );
... |
C | #include <stdio.h>
#define MAXLINE 1000 /* maximum input line length */
int getlinep(char *, int);
void copy(char to[], char from[]);
/* print the longest input line */
main()
{
char s[MAXLINE], maxs[MAXLINE];
int len, max;
max = 0;
while ((len = getlinep(s, MAXLINE)) > 0)
{
if (len > max)
{
... |
C | // Stack using Linked List
#include<stdio.h>
#include<stdlib.h>
typedef struct Stack {
int data;
struct Stack *next;
}Stack;
Stack *top = NULL;
Stack* newNode() {
Stack *temp=(Stack *)malloc(sizeof(Stack));
temp->data=0;
temp->next=NULL;
return temp;
}
int stack_empty() {... |
C | #include <unistd.h> //biblioteca necessárioa para chamar a função write.
void ft_putstr(char *str) //definindo a função void com um ponteiro tipo char como parâmetro.
{
int i = 0; //definindo uma variável tipo int para servir de ponto de partida para a repetição while
while (str[i] != '\0') //repetição while que pe... |
C | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* reverseKGroup(struct ListNode* head, int k) {
if(head == NULL)
return head;
const int MAX = 8192; //length of linked list
int i = 0, len = 0;
struct ListNode ... |
C | /**
* @file send_data.c
* @author Zuber Ahmed
* @brief Source code to send data serially using USART with a set BAUD rate
* @version 0.1
* @date 2021-07-28
*
* @copyright Copyright (c) 2021
*
*/
#include "send_data.h"
void USART_initialization(uint16_t baud_rate)
{
UBRR0L = baud_rate; ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#define PORT 1111
int main(){
struct timeval start, intermediate, stop;
int clientSocket, ret;
struct sockaddr_in se... |
C | #include "unity.h"
#include "blhm.h"
#include <stdio.h>
int cmp_key(int m, int r) {
return m - r;
}
size_t int_map_hash(int m) {
return m;
}
HASH_MAP(int_map, int, int, int_map_hash, cmp_key, 16, 1024);
struct int_map a;
void setUp(void) {
int_map_init(&a);
}
void tearDown(void) {
int_map_free(&a);
}
voi... |
C | #include <stdio.h>
int main(){
int ind[] = {0, 2};
int x[3][4] = {{0,1,2,3},{4,5,6,7},{8,9,10,11}};
printf(x[ind]);
}
|
C |
#include "../../lib/test_lib.h"
#include "../../libmx.h"
char *test_case_name = "mx_binary_search";
// Tests
void test_binary_search() {
// Given
char *arr[] = {"222", "Abcd", "aBc", "ab", "az", "z"};
int count= 0;
// When
int result = mx_binary_search(arr, 6, "ab", &count);
// Then
AS... |
C | #include "ClientReadBuffer.H"
#include "ClientChannel.H"
#include "util.H"
int ClientReadBuffer::hasCompleteMessage () {
unsigned int headerLength, dataLength, trailerLength;
return locateMessage (buffer_ + start_, buffer_ + start_ + length_,
headerLength, dataLength, trailerLength);
}
int ClientReadBuffer::loca... |
C | #include<stdio.h>
//输入十个整数,将最小的与第一个交换,把最大的与最后一个交换。写三个函数:(1)输入十个数;(2)进行处理;(3)输出10个数。
void myScan(int *p, int n);
void myPrint(int **p, int n);
void covrt(int **p, int n);
void myScan(int *p, int n)
{
int i = 0;
while(i < n)
{
printf("输入第%d个数:", i+1);
scanf("%d", p+i);
i++;
}
}
void myPrint(int **p, int n)
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_del.c :+: :+: :+: ... |
C | // Lstipple.c
// OpenGL SuperBible, Chapter 4
// Demonstrates line stippling
// Program by Richard S. Wright Jr.
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h>
#include <math.h>
// Define a constant for the value of PI
#define GL_PI 3.1415f
// Rotation amounts
static GLfloat xRot =... |
C | #include<stdio.h>
#include<conio.h>
main()
{
int sum=0,temp,n,r;
printf("Enter the number:\n");
scanf("%d",&n);
temp=n;
while(temp!=0)
{
r=n%10;
n=n/10;
sum=sum+(r^3);
}
if(sum==temp)
printf("%d is armstrong number");
else
printf("%d is not an armstrong number");
}
|
C | #include <stdio.h>
#include "SDL.h"
#include "SDL_image.h"
extern unsigned long long int tsCount();
extern void fadeShiftAsm(unsigned char *buf, const int width, const int height);
void fadeShiftC(unsigned char* buf, int width, int height) {
unsigned long long int size = width * height;
while (size--) {
... |
C | /*
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef LIBUNWIND_H
#define LIBUNWIND_H
#include "sdkconfig.h"
#include <stddef.h>
#include <stdint.h>
#if CONFIG_IDF_TARGET_ARCH_RISCV
#include "libunwind-riscv.h"
#elif CONFIG_IDF_TARGET_X8... |
C | //@File: vars00.c
//
// The {\tt vars00} program first allocates a number of variables in the
// Real-Time database and then randomly reads values of variables
// while collecting data to evaluate response times.
//@
#define VERSMAJ 1
#define VERSMIN 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#i... |
C | #include <stdio.h>
#include<math.h>
int main()
{
int a,b,c,lar,sec_large,small;
printf("Enter sides of tringle");
scanf("%d%d%d",&a,&b,&c);
if(a==b&&b==c)
printf("Equilateral");
else if(a==b||b==c||c==a)
printf("Isoceles");
else
printf("Scalene");
lar = a... |
C | /*
* Pipeline.c
*
* Created: 04.11.2017 16:46:16
* Author: Alex
*/
#include "Pipeline.h"
S_EFF_PARAMS eff_params[EFFECT_COUNT];
static uint8_t g_eff_indx = 0;
static uint8_t g_total_effects = 0;
void build_effect_pipeline() {
//
eff_params[g_total_effects].init_callback = init_color_swap;
eff_params[g_t... |
C | bool isUgly(int num) {
if(num==1) return true;
while(num!=2 && num!=3 && num!=5 && num!=0){
if(num%2==0) num/=2;
else if(num%3==0) num/=3;
else if(num%5==0) num/=5;
else return false;
}
if(num!=0) return true;
else return false;
}
|
C | /* FULLY AUTOMATIC VENDING MACHINE – dispenses your cuppa on just press of button. A vending machine can serve range of products as follows:
Coffee
Espresso Coffee
Cappuccino Coffee
Latte Coffee
Tea
Plain Tea
Assam Tea
Ginger Tea
Cardamom Tea
Masala Tea
Lemon Tea
Green Tea
... |
C |
// Figure 9-37. A program with system-call
int main(int argc *char argv[]) {
int fd, n = 0;
char buf[1];
fd = open("data", 0);
if (fd < 0) {
printf("Bad data file\n");
exit(1);
} else {
while (1) {
read(fd, buf, 1);
if (buf[0] == 0) {
... |
C | // common.h -- Defines typedefs and some global functions.
// From JamesM's kernel development tutorials.
#ifndef COMMON_H
#define COMMON_H
// this is a macro which calls the panic function and automatically
// specifies the line and the file of the MACRO usage
#define PANIC(msg) panic(msg, __FILE__, __LI... |
C | /*
A biblioteca padrão da linguagem C possui muito poucas funções para manipulação de cadeias de caracteres.
Uma das funções muito comumente utilizadas em manipulação de strings é a função trim, que remove espaços e
tabulações no início e fim de uma cadeia de caracteres. Essa função é geralmente utilizada para "corri... |
C | #ifndef INODE_H
#define INODE_H
#include <unistd.h>
#include <sys/types.h>
typedef struct inode {
mode_t mode; //read/write/execute
uid_t uid; // user ID of the file owner
off_t size; // size of the file in bytes
time_t atime; // last access time
time_t ctime; // creation time
... |
C | /* The kernel call implemented in this file:
* m_type: SYS_VIRCOPY
*
* The parameters for this kernel call are:
* m5_l1: CP_SRC_ADDR source offset within userspace
* m5_i1: CP_SRC_ENDPT source process endpoint
* m5_l2: CP_DST_ADDR destination offset within userspace
* m5_i2: CP_DST_ENDPT destinat... |
C | /* record.h
* purpose and definitions:
* - record structure
* - parses records
* - sets the address for emittion
* - emits record adresses
* global variables:
* LC_old , LC_cur , assembly , second_pass
* Author: Nick Stanwood
*************************************************************************... |
C | #include <stdio.h>
#include <math.h>
int a = 0;
int y = 0;
int z = 0;
double x = 0;
int main(void)
{
printf("a = ");
scanf("%d", &a);
printf("y = ");
scanf("%d", &y);
printf("z = ");
scanf("%d", &z);
if (pow(y,2)-(2*a) <= 0)
{
printf("Виконується логарифмування числа, меншого за нул... |
C | #ifndef LOGGING_H
#define LOGGING_H
#include <bwio.h>
#include "arm_lib.h"
#include "syscall.h"
#define LOGLEVEL_NONE 0 // logging off
#define FATAL_RAINBOW 0 // Alleviate pain caused by fatal errors
// Sending a fatal message implies execution cannot continue.
// The same is true for failed asserts. In both of th... |
C | /*******************************************************************************
Header Files
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
/*******************************************************************************
List Structure
*********... |
C | float pp1(int n)
{
int i;
float s;
for (i=1;i<=n;i++)
s+=(float)1/i;
return s;
}
float dequy(int n)
{
if (n==1) return 1;
return (1/(float)n)+dequy(n-1);
}
main()
{
int n;
printf("Nhap n : ");
scanf("%d",&n);
printf("\nPhuong phap 1 : S=%f",pp1(n));
printf("\nDe quy ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(x, y) ((x) > (y) ? (x) : (y))
int main()
{
int cases;
while (scanf("%d", &cases) != EOF && cases) {
int book[2000] = { 0 }, max = -1, max_num = -1, max_left = -1,
max_right = -1;
int original... |
C | #include<pthread.h>
#include<semaphore.h>
#include<stdio.h>
const int max=10;
pthread_mutex_t m1=PTHREAD_MUTEX_INITIALIZER;
sem_t s1;
void* efun1(void* pv) //producer
{
int i;
printf("A--welcome\n");
pthread_mutex_lock(&m1);
for(i=1;i<=max;i++)
{
printf("A--%d\n",i);
sleep(1);
}
pthread_mutex_unlock(&m1... |
C | //add characters to char array inside struct
#include<stdio.h>
#include<string.h> //may be added as well
int main(){
struct Ev{
int oda_sayisi;
char adres[100];
float metrekare;
} test_ev,test_ev2;
test_ev.oda_sayisi=4;
test_ev.metrekare=120.5;
//if you want to work on char array inside a structure
//yo... |
C | /*********************************************************************
* pullup.c : Change the pullup resistor setting for GPIO pin
*********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <setjmp.... |
C | #include"stdafx.h"
#include"c.h"
#include<stdio.h>
#include<stdlib.h>
int factorial6_10(int n)
{
int k, total = 1;
for (k = 1; k <= n; k++)
total *= k;
return total;
}
void ex6_10()
{
int num;
printf("пJ@Ӽ:");
scanf("%d", &num);
printf("Factorial(%d)=%d\n", num, factorial6_10(num));
} |
C | //////////////////////////////////////////////////////////////
// Accept on number from user if number is less than 10 then print "Hello" otherwise print "Demo".
// Author : Annaso Chavan
/////////////////////////////////////////////////////////////
#include<stdio.h>
void Display(int no)
{
if(no < 10)
{
printf("He... |
C | #include "9cc.h"
// 入力プログラム
char *user_input;
int main(int argc, char **argv)
{
if (argc != 2)
{
error("引数の個数が正しくありません");
return 1;
}
// トークナイズしてパースする
user_input = argv[1];
token = tokenize(user_input);
Function *pg = program();
codegen(pg);
return 0;
}
|
C | #include <stdio.h>
#define MAX 64
int team_num(int num);//输入参赛队伍数量
void team_name(char name[][MAX], int num);//输入每个参赛队伍的名称
int arrange(int begin, int num);//对每个参赛队伍进行排序
int show(char name[][MAX], int num);//将结果打印出来
int schedule[MAX][MAX];
int team_num(int num)
{
int flag = 1;
printf("请输入参赛的队伍数量:");
while(flag)
... |
C | #ifndef FILE_ACCESS_IMPL_H
#define FILE_ACCESS_IMPL_H
typedef struct file_struct{
FILE* fp;
unsigned long long size;
unsigned long long total_read_size;
unsigned long long total_write_size;
char fname[FILE_NAME_SIZE];
}file_st;
/* モード ファイル 機能 ファイルがないとき
* "r" テキスト 読み取り エ... |
C | #include "./ext2_find.h"
int trobarArxiuExt(int fd, const char *nomArxiu, unsigned int offset, char delete){
int saltsFins1erInode = readInodeSizeExt(fd)*(readFirstInodeExt(fd)-1);
int i_block[15];
int counter;
int trobat = 0;
//Anar al primer inode (Inode 11).
int inodeDir= readFirstInodeExt(fd)*readInod... |
C | #include "alloc.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int opcode = 0;
char words[9];
int main(int argc, char *argv[])
{
printf("ԤڳĹĿ¼ﴴһΪ encryptedwords.txt ļд8ֵݣ\n");
printf("ѡ\n1.\n2.\n.˳\n");
scanf("%d",&opcode);
switch (opcode)
{... |
C | /**
* Exercice 1.14
*
* Write a program to print a histogram of the frequencies of
* different character in its input.
*
**/
#include <stdio.h>
void main()
{
int c, i, max;
int nChar[26];
for (i = 0; i < 27; i++)
nChar[i] = 0;
while ((c = getchar()) != EOF)
{
if (c >= '... |
C | #include "binary_trees.h"
#include "binary_level_func.c"
/**
* binary_tree_levelorder - prints the binary tree by level order
* @tree: the node to the tree
* @func: function pointer
*/
void binary_tree_levelorder(const binary_tree_t *tree, void (*func)(int))
{
binary_level_t *level_head;
if (tree == NULL || fun... |
C | /**************************
*** ImageColor.c ***
*************************/
#include "ImageType/ImageType.h"
#include "Image2Tool.h"
void
image2_average( image_type *im, int x0, int y0, int width, int height, float *av )
{
short *sp;
float sum;
int i, j, n;
sum = 0;
for( i = 0 ; i < height ; i++ ){
sp = (s... |
C | //Shrenik Bhatt
//Lab5Part1
//This program will be used in order to encrypt a number that has a minimum of 6 digits. it uses a function called add4 in order to add4 to each value.
//It also uses a shift function in order to shift the digits to the left. It then uses a print function to print out the results.
#include... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//DECLARANDO FUNCOES
char* diaDaSemana(int);
void vendaIngresso();
int verificarEscolha(char escolha);
typedef struct comprador{
int assento;
int idade;
char *estudante;
char *professor;
double precoIngresso;
struct comprador *proximo;
}celul... |
C | #ifndef ASSET_H
#define ASSET_H
/*
*
*/
#include "common.h"
#include <SDL.h>
struct asset_t {
void *bytes;
SDL_Texture *texture;
char *name;
s32 w, h, c;
};
struct asset_container_t {
struct asset_t *assets;
size_t assets_len, assets_cap;
};
// function definition
// AssetLoad : loads a single asset from... |
C | /*
* @file i2c.c
* @brief Source file for controlling the I2C registers
*
* This header file has functions that initializes the
* I2C and connects to the TMP102 temperature sensor,
* which then returns the current temperature and the alert
* status
*
* @authors Rahul Ramaprasad, Prayag Milan Desai
* @date Nov... |
C | #include <stdio.h>
int main () {
long int N, M, aux;
while(1){
scanf("%ld %ld", &N, &M);
if(N == 0 && M == 0){
break;
}
aux = (N - M)/2;
if(M == 1||M == 4||M == 9||M == 11||M == 16||M == 18||M == 20||M == 22||M == 24||M == 25||M == 26||M == 27||M == 28||M =... |
C | /*
* project_euler_prob6.c
*
* Created on: Jul 19, 2012
* Author: ssimmons
* Returns difference between sum of squares and square of sum of numbers 1-100
*/
#include <stdio.h>
#include <math.h>
int main(){
int squareofsum = (5050*5050); // a priori knowledge
int sumofsquares = 0, i;
for (i = 1; i<101;... |
C | //
// Created by Administrator on 2019/1/10/010.
//
#include <time.h>
#include "byteutils.h"
#ifdef WIN32
#include <Windows.h>
#endif // WIN32
int byteutils_get_int(unsigned char* b, int offset) {
return ((b[offset + 3] & 0xff) << 24) | ((b[offset + 2] & 0xff) << 16) | ((b[offset + 1] & 0xff) << 8) | (b[offset] &... |
C | #include "param.h"
#include "types.h"
#include "defs.h"
#include "x86.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
#include "spinlock.h"
struct {
struct spinlock lock;
struct shm_page {
uint id;
char *frame;
int refcnt;
} shm_pages[64];
} shm_table;
void shminit() {
int i;
initlo... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "sport.h"
void mostarDeporte(edeportes sport)
{
printf(" %d %s\n", sport.id, sport.descripcion);
}
int mostrarDeportes(edeportes sport[], int tam)
{
int error = -1;
if(sport != NULL && tam > 0)
{
print... |
C | #include "header.h"
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] != '\0' || s2[i] != '\0')
{
if (s1[i] == s2[i])
i++;
else if (s1[i] > s2[i])
return (s1[i] - s2[i]);
else if (s1[i] < s2[i])
return (s1[i] - s2[i]);
}
return (0);
}
char *read_input()
{
char ch;
char *str;
int... |
C | /*
* options.c
*
* Created on: Nov 27, 2013
* Author: DiamondS
*/
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include "options.h"
#include "types.h"
void OPTIONS_Init(options_t *options, int argc, char *argv[])
{
int nextOption;
const char *shortOptions = "hVdcgirtw";
const str... |
C | #include <stdio.h>
#include <conio.h>
int main(){
int uzun,kisa;
printf("Uzun kenar yildiz adedini giriniz: "); scanf("%d", &uzun);
printf("Kisa kenar yildiz adedini giriniz: "); scanf("%d", &kisa);
for(int i=0; i<kisa; i++){
for(int j=0; j<i; j++){
printf(" ");
}
for(int j=0; j<uzun; j++){
... |
C | #include <stdio.h>
#include <stdlib.h>
int main (void)
{
execv("print",NULL);
printf("Returned from execv call.\n");
return 0;
}
|
C | #include "elf64.h"
size_t elf64_hash(const unsigned char* name)
{
size_t h = 0, g;
while (*name) {
h = (h << 4) + *name++;
if ((g = h & 0xf0000000) != 0) {
h ^= g >> 24;
}
h &= 0x0fffffff;
}
return h;
}
|
C | /*
C 标准库的 float.h 头文件包含了一组与浮点值相关的依赖于平台的常量。
这些常量是由 ANSI C 提出的,这让程序更具有可移植性。
在讲解这些常量之前,最好先弄清楚浮点数是由下面四个元素组成的
S 符号 ( +/- )
b 指数表示的基数,2 表示二进制,10 表示十进制,16 表示十六进制,等等...
e 指数,一个介于最小值 emin 和最大值 emax 之间的整数。
p 精度,基数 b 的有效位数
floating-point = ( S ) p * b^e
*/
#include <stdio.h>
#include <float.h>
int... |
C | #include "bzpartial.h"
#include "bzextract.h"
#include <string.h>
#include <stdio.h>
#include <expat.h>
#include <getopt.h>
#include <assert.h>
#include <unistd.h>
void bze_help(char *name) {
fprintf(stderr, "usage: %s [-i offset] [-s skip] [-c count] file.bz2\n", name);
fprintf(stderr, "version: 0.2\n");
fprintf(... |
C | #include<stdio.h>
int main()
{
int x = 9;//ʹʹӡո
for (int i = 0; i < 9; i++)//9Уѭ9
{
for (int j = x; j>0; j--)//ӡոÿοոһ
{
printf(" ");
}
x--;//ʹӡĿոÿμһ
for (int m = 0; m <= i * 2; m++)//ӡ * ÿ
{
printf("*");
}
printf("\n");//
}
//ʼӡ ӡ9УҪôһУҪôһ һУ8
int l = 2;
for (int i = 8; i >0; i--)//ӡ... |
C | /*
Implement a function which checks whether a string appears as a substring in
another string. It should return 1 if the string occurs and 0 if it does not.
Its declaration could be:
int strsearch(char * src, char * substr);
*/
#include <stdio.h>
#include <stdlib.h>
int strsearch(char *src, char *substr);
in... |
C | #include<stdio.h>
int main()
{
int n;
abc:
printf("Enter value: ");
scanf("%d",&n);
if(n!=20){
goto abc;
}
printf("\n%d\n",n);
return 0;
}
|
C | //Programme to find the Sine Series
#include<stdio.h>
#include<stdlib.h>
int main()
{
int loop,n;
float val1,sum=0,term;
printf("The sine series will be \n");
for(loop=0;loop<=360;loop=loop+30)
{
val1=loop*3.1415/180;//Changing into redian
term=val1;
sum=val1;
n=1;
while((term>0.00001)||(term<-0.00... |
C | #ifndef __MP_HASHMAP__
#define __MP_HASHMAP__
#include <stddef.h>
#include <stdint.h>
/*
PROBLEM:
* The hashmap does not own the items added to it
* When using put(...), the key and the value should be copied and pointers to that
should be stored in the linked list. When clearing, these pointers should... |
C | // Write a program that converts strings to integer and floating point numbers
// and calculates the sum of these converted numbers.
// The strings represent integer or floating point numbers
#include <stdio.h>
#include <stdlib.h>
#define SIZE 6
// function for converting from string to floating point numbers
doubl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.